-1
我使用mandrillapp進行郵件的使用以下方法。但我需要從掃描儀發送JPEG或PDF或PNG掃描副本。PHP - 如何發送png或jpg電子郵件附件?
我該怎麼做?
public static function sendBcc($from, $to, $subject, $htmlBody,
$bcc = '', $bcc1 = '', $utype = '') {
$bcc = '', $bcc1 = '', $utype = '') {
$uri = 'https://mandrillapp.com/api/1.0/messages/send.json';
$postData = array(
'key' => 'aaa',
'message' => array(
'html' => $htmlBody,
'text' => $htmlBody,
'subject' => $subject,
'from_email' => $from,
'from_name' => 'a',
'to' => array(
array('email'=>$to, 'name' => 'a', 'type' =>'to'),
array('email'=>$bcc,'name' => 'Bcc 1', 'type' => 'bcc'),
array('email'=>$bcc1,'name' => 'Bcc 2', 'type' => 'bcc')
),
),
);
$postString = json_encode($postData);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $uri);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);
$result = curl_exec($ch);
//curl_close($ch);
}