Zum Inhalt springen

EXT: htmlmail addAttachment

Erstellt am 31. August 2011 · 1 Antwort · letzte Antwort am 1. September 2011

Tags: Frage

chainsaw81 ·

Hi zusammen,

ich verzweifel an der Aufgabe via Email einen Anhang zu verschicken ...😢

Nach lange Suche in Google fand ich so einige Hinweise - nun wird zumindest die Email verschickt, jedoch ohne Anhang.

Hat jemand noch einen Rat?

#hier müssen die entsprechenden Parameter gesetzt werden
$email['address']='empfaenger@zuhause.de';
$email['body']='<h1>Message</h1><p>dies ist eine HTML-Mail. Klick mal auf <a href="http://www.google.de">Google</a></p>';
$email['subject']='eine HTML-Mail';
 
$html_start='<html><head><title>HTML-Mail</title></head><body>';
$html_end='</body></html>';
 
$this->htmlMail = t3lib_div::makeInstance('t3lib_htmlmail');
$this->htmlMail->start();
$this->htmlMail->recipient = $email['address'];
$this->htmlMail->subject = $email['subject'];
$this->htmlMail->from_email = $this->conf['fromEmail'];
$this->htmlMail->from_name = 'XXX XXX';
$this->htmlMail->returnPath = $this->conf['adminEmail'];
$this->htmlMail->addPlain($email['body']);
$this->htmlMail->addAttachment('pfad/zu/meinem/xxx.pdf');
$this->htmlMail->setHTML($this->htmlMail->encodeMsg($html_start.$email['body'].$html_end));
$this->htmlMail->send($email['address']);

(Quelle: http://www.sk-typo3.de/Mail-erzeugen.215.0.html)

$this->htmlMail->addAttachment('pfad/zu/meinem/xxx.pdf');

Danke u Gruß

manu3 ·

Hab leider fast das selbe Problem.
Dieser Code funktioniert mit TYPO3 4.3 ohne Probleme und ab 4.4 nicht mehr.

$htmlMail = t3lib_div::makeInstance('t3lib_htmlmail');
				$htmlMail->start();
				$htmlMail->setRecipient($toEmail);
				$htmlMail->subject = "betreff";
				$htmlMail->from_email = "da";
				$htmlMail->from_name = "Dem";
				$htmlMail->setHTML($htmlMail->encodeMsg($html));
				$htmlMail->addAttachment("pfad zur Datei der auch stimmt");
				$htmlMail->send($htmlMail->recipient);

Und bei diesem bekomm ich immer so eine E-Mail

------------part_2_4e5f84b71ef7d
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

test
------------part_2_4e5f84b71ef7d

Jemand hierzu einen Rat?