[Typo3-dev] Sending plaint text email with attachment using t3lib_htmlmail
Makrela Corporation
misza at mikado.neostrada.pl
Mon Jul 18 02:50:58 CEST 2005
Hello,
My goal is to send a plain text email with an attachement to a single
recipient.
Therefore I have used functions from the t3lib_htmlmail class and in a
result email is correctly delivered (charset, subject, text content, etc.
are fine).
But there is a serious problem with the attachment, which is not included
properly.
My code:
----------------------------------------------------------
$mail = t3lib_div::makeInstance('t3lib_htmlmail');
$mail->start();
$mail->useBase64();
$mail->plain_text_header = "Content-Type: multipart/mixed;
charset=UTF-8\nContent-Transfer-Encoding: quoted-printable";
$mail->subject = $subject;
$mail->from_email = $fromEmail;
$mail->from_name = $fromName;
$mail->organisation = $organisation;
$mail->replyto_email = $replyToEmail;
$mail->replyto_name = $replyToName;
$mail->mailer = $mailerName;
$mail->setRecipient($recipientName);
$mail->addAttachment($file);
$mail->setPlain($emailText);
$mail->setHeaders();
$mail->setContent();
$mail->sendTheMail();
----------------------------------------------------------
And obtained email (in. ex. in Outlook Express) looks like that:
----------------------------------------------------------
Sample plain text message.
-----
Content-Type: image/gif
name=e_wiz.gif"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename=e_wiz.gif"
R0lGODlhFgAXAJEAALdqVAAAAP////j18iH5BAAAAAAALAAAAAAWABcAAAJLXI6pauAPYzyyVmqz
w2+lGYBeCHHbISzgJLRuS3bxlgawPQOm/r75bru5fr/ecFUaETWaHTMpGUVzT9n0c6FWdVRPdjsF
TwzK8qAAADs
-------
------------part_2_42dacfaa33486--
----------------------------------------------------------
Now I would like to ask you kindly for advice how to ovecome this obstacle.
It seems very helpful to paste a sample working code either.
regards
Misza
More information about the TYPO3-dev
mailing list