我正在使用 Pear 的 Mail Mime 通过 SMTP Gmail 从我的服务器发送一封电子邮件。但是,当我添加附件时,它根本不显示。
$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);
一切正常,只是附件完全丢失了..我已经搜索了几个小时..我很感激任何提示..