php smtp发送附件,PHP:如何使用smtp设置发送带附件的电子邮件?
生活随笔
收集整理的這篇文章主要介紹了
php smtp发送附件,PHP:如何使用smtp设置发送带附件的电子邮件?
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
發現此代碼是google:// pear郵件附件搜索的首批點擊之一.
include('Mail.php');
include('Mail/mime.php');
$text = 'Text version of email';
$html = '
HTML version of email';$file = './files/example.zip';
$crlf = "rn";
$hdrs = array(
'From' => 'someone@domain.pl',
'To' => 'someone@domain.pl',
'Subject' => 'Test mime message'
);
$mime = new Mail_mime($crlf);
$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$mime->addAttachment($file,'application/octet-stream');
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail =& Mail::factory('mail', $params);
$mail->send('mail@domain.pl', $hdrs, $body);
總結
以上是生活随笔為你收集整理的php smtp发送附件,PHP:如何使用smtp设置发送带附件的电子邮件?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 为什么说iPhone13才是真旗舰
- 下一篇: php怎么检查输入名称,PHP |通过$