0
我使用Pear's Mail Mime通過SMTP Gmail從我的服務器發送電子郵件。但是,當我添加附件時,它不會顯示出來。通過Mime/SMTP Gmail服務器(PHP,PEAR)發送的郵件中缺少附件
$smtpinfo["host"] = "ssl://smtp.gmail.com";
$smtpinfo["port"] = "465";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "xxx";
$smtpinfo["password"] = "xxx";
$headers = array(
'From' => $from,
'To' => $to,
'Subject' => utf8_decode($subject)
);
$mime = new Mail_mime();
$mime->setHTMLBody($html);
$mime->addAttachment("http://ww.url.of.a.file.that.exists.100percent.jpg", "image/jpeg");
$body = $mime->get(array('html_charset' => 'utf-8','charset' => 'utf-8'));
$headers = $mime->headers($headers);
$smtp = Mail::factory('smtp', $smtpinfo);
$mail = $smtp->send($to, $headers, $body);
一切正常,只是attachement是完全丟失.. 我一直在google搜索小時。我很感激任何提示..