Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
使用 PHPMailer 解決輸出 MIME 格式的問題
$service = new Google_Service_Gmail($client);
try {
$mail = new PHPMailer();
$mail->CharSet = "UTF-8";
$mail->From = "發信端信箱";
$mail->FromName = "發信端別名";
$mail->AddAddress("收信端信箱", "收信端別名");
$mail->AddReplyTo("回信端信箱", "回信端別名");
$mail->Subject = "信件主題";
$mail->Body = "信件內文";
$mime = $mail->getSentMIMEMessage();
$mime = rtrim(strtr(base64_encode($mime), '+/', '-_'), '=');
$mensaje = new Google_Service_Gmail_Message();
$service->users_messages->send('me', $mensaje);
} catch (Exception $e) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.