我正在使用mailgun
发送电子邮件,附件没有通过电子邮件发送,正常工作
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 <test@gmail.com>',
'to' => $email,
'subject' => $subject,
'html' => $msg,
'attachment'=>"/home/public_html/cms/upload/quiz.jpg"
));
$result = curl_exec($ch);
curl_close($ch);
return $result;
}