本文整理汇总了PHP中htmlMimeMail::getRFC822方法的典型用法代码示例。如果您正苦于以下问题:PHP htmlMimeMail::getRFC822方法的具体用法?PHP htmlMimeMail::getRFC822怎么用?PHP htmlMimeMail::getRFC822使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htmlMimeMail
的用法示例。
在下文中一共展示了htmlMimeMail::getRFC822方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
*/
$mail_1->setCrlf("\n");
/**
* First email.
*/
$mail_1->setHTML($mail_1->getFile('example.html'), $mail_1->getFile('example.txt'), dirname(__FILE__) . '/');
/**
* Add the attachment
*/
$mail_1->addAttachment($mail_1->getFile('example.zip'), 'example.zip', 'application/zip');
/**
* Don't send this email, but use the
* get_rfc822() method to assign it to a
* variable.
*/
$mail_1->setReturnPath('return@example.com');
$mail_1->setFrom('John Doe <john.doe@example.com>');
$mail_1->setSubject('Test attached email');
$mail = $mail_1->getRFC822(array('Nobody <nobody@example.com>'));
/**
* Now start a new mail, and add the first
* (which is now built and contained in
* $mail) to it.
*/
$mail_2 = new htmlMimeMail();
$mail_2->setText('This email has an attached email');
$mail_2->addAttachment($mail, 'Test for attached email', 'message/rfc822', '7bit');
$mail_2->setFrom('Foo <foo@example.com>');
$mail_2->setSubject('Test with attached email');
$result = $mail_2->send(array('postmaster@localhost'));
echo $result ? 'Mail sent!' : 'Failed to send mail';