Global:
$mail = t3lib_div::makeInstance('t3lib_mail_Message');
$mail->setFrom(array($sender => $sender_name));
$mail->setReplyTo($reply_to);
$mail->setTo($row['email']);
$mail->setSubject($subject);
$body = 'Any html code!';
preg_match_all("/\embed(Swift_Image::fromPath($src));
if($cid){
$body = str_replace($src, $cid, $body);
}
}
}
$mail->setBody($body, 'text/html', 'utf-8');
$mail->send();
typo3<4.7 [4.7+己废弃]
require_once(PATH_t3lib.’class.t3lib_htmlmail.php’);
// Prepare mailer and send the mail
$mailer = t3lib_div::makeInstance(‘t3lib_htmlmail’);
$mailer->start();
$mailer->useBase64();
$mailer->from_email = ”;
$mailer->from_name = ”;
$mailer->charset = ‘iso-8859-1′;
//$mailer->replyto_email = $this->reply_email;
//$mailer->replyto_name = ‘TEST-TASK’;
$mailer->subject = ”;
//$mailer->addPlain($mailBody);
$mailer->addHTML($url); //支持图片CID
$mailer->setRecipient(recipient@email.com);
$mailer->setHeaders();
$mailer->setContent();
$mailer->sendtheMail();