1
我使用mailgun
發送電子郵件發送附件時,附件不經過電子郵件,工作PHP捲曲而不能通過電子郵件
function send_mail($email,$subject,$msg) {
$api_key="key-532cf742c1";/* Api Key got from https://mailgun.com/cp/my_account */
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, 'api:'.$api_key);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_URL, 'https://api.mailgun.net/v3/test.com/messages');
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
'from' => 'Open <[email protected]>',
'to' => $email,
'subject' => $subject,
'html' => $msg,
'attachment'=>"/home/public_html/cms/upload/quiz.jpg"
));
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
你連接一個嘗試文件名,而不是文件 – 2016-12-31 03:26:07
http://stackoverflow.com/questions/14229656/mailgun-sent-mail-with-attachment –