我正在使用PHPMailer来构建电子邮件.我只使用PHPMailer进行MIME消息格式化,而不是发送.
然后我从PHPMailer对象中提取原始消息,然后将其传递给Gmail API进行处理.
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
$mail->IsHTML(true);
//Disable SMTP debugging
// 0 = off (for production use)
$mail->SMTPDebug = 0;
//Set who the message is to be sent from
$mail->setFrom("fromaddress@domain.com", "From Name");
//Set an alternative reply-to address
$mail->addReplyTo("replyaddress@domain.com", "Reply Name");
//Set to address
$mail->addAddress("address@domain.com", "Some Name");
//Set CC address
$mail->addCC("ccaddress@ccdomain.com", "Some CC Name");
//Set BCC address
$mail->addBCC("bccaddress@ccdomain.com", "Some BCC Name");
//Set the subject line
$mail->Subject = "Test message"; …Run Code Online (Sandbox Code Playgroud)