コード例 #1
0
ファイル: example.5.php プロジェクト: 4v4t4r/CTF-LCC
*/
$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('*****@*****.**');
$mail_1->setFrom('John Doe <*****@*****.**>');
$mail_1->setSubject('Test attached email');
$mail = $mail_1->getRFC822(array('Nobody <*****@*****.**>'));
/**
* 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 <*****@*****.**>');
$mail_2->setSubject('Test with attached email');
$result = $mail_2->send(array('postmaster@localhost'));
echo $result ? 'Mail sent!' : 'Failed to send mail';