PHPMailer普通发票邮件将成为垃圾邮件

时间:2019-12-10 21:11:56

标签: php phpmailer

有人可以告诉我如何提高邮件质量吗?现在,许多邮件都直接进入垃圾邮件文件夹,例如Hotmail。 我正在使用PHP Mailer,这是多个客户用来发送发票的通用脚本。

我正在使用的代码:


    $email->IsSMTP();                                      // Set mailer to use SMTP
    $email->Host = 'mail.xxx.com';                 // Specify main and backup server
    $email->Port = 587;                                    // Set the SMTP port
    $email->SMTPAuth = true;                               // Enable SMTP authentication
    $email->Username = 'invoices@xxx.com';                // SMTP username
    $email->Password = 'xxx';                  // SMTP password
    $email->SMTPSecure = 'tls';                            // Enable encryption, 'ssl' also accepted

    $email->AddReplyTo($user_check, $company);             // $user_check = company email.
    $email->SetFrom('invoices@xxx.com', $company);
    $email->Priority  = 1;
    $email->Subject   = $_POST['InvoiceSubject'];
    $email->Body      = $_POST['InvoiceMSG'];
    $email->AddAddress($_POST['InvoiceEmail']);
    $email->AddCC($_POST['InvoiceCC']);
    $email->AddBCC($user_check);

    $file_to_attach = '../pdf-invoices/'.$client_token.'/Invoice_'.$_POST['InvoiceNumber'].'.pdf';

    $email->AddAttachment( $file_to_attach , $_POST['InvoiceNumber'].'.pdf' );

    if($email->Send()) {
        $mailSend = true;
    } else {
        $mailSend = false;
    }

0 个答案:

没有答案