如何使用PHP中的SMTP服务器获取发送报告和读取邮件的状态

时间:2016-04-12 07:18:33

标签: php

我发送的大量邮件来自数据库中的提取

function sendMail($subject,$to,$cc,$message){

    $mail = new PHPMailer;
    $mail->isSMTP();               // Set mailer to use SMTP
    $mail->Host = 'myhostname';  // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;

    $mail->Username = 'myusername';
    $mail->Password = 'pass';

    $mail->From = 'myaddress';
    $mail->FromName = 'Test';
    $mail->addAddress($to, '');     // Add a recipient
    $mail->addCC($cc);              // Add a recipient

    $mail->isHTML(true);                                  // Set email format to HTML

    $mail->Subject = ''.$subject;
    //$mail->AddEmbeddedImage('mail_logo.png', 'logoimg', 'mail_logo.png');
    $mail->Body    = $message;
$mail->AltBody="This is text only alternative body.";


    if(!$mail->send()){
        //echo $mail->ErrorInfo;
        return false;
    }
    else
    {
        return true;
    }
}

如何知道用户是否阅读了电子邮件以及邮件发送报告???

0 个答案:

没有答案