带有BCc和Cc的PHP邮件程序

时间:2017-02-06 08:38:17

标签: php phpmailer

我在使用PHP邮件程序课时遇到问题。问题是我在收到此错误一段时间后发送电子邮件:
enter image description here

另外,当我在php邮件代码中对Bcc和Cc部分发表评论时,没有任何变化......仍然在我的收件箱中收到相同的垃圾邮件。 这是我发送电子邮件的代码:

if (mysqli_query($conn, $change)) {

    $mail->isSMTP();  
    $mail->CharSet = 'UTF-8';                                    // Set mailer to use SMTP
    $mail->Host = 'mail.xxx.xxx.xx';  // Specify main and backup SMTP servers
    $mail->SMTPAuth = false;                               // Enable SMTP authentication
    $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 25;                                    // TCP port to connect to

    $mail->setFrom('prigovori@xxx.xxx.xx', 'SOME ADDRESS');
    $mail->addAddress($someMail); /// Add a recipient

    $mail->addReplyTo('prigovori@xxx.xxx.xx');
    //CC and BCC
    //$mail->addCC("cc@example.com");  // i put those two lines under comments in order to disable email spam but nothing changes
    //$mail->addBCC("bcc@example.com");


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

    $mail->Subject = 'EMAIL SUBJECT';
    $mail->Body    =   '<h2 style="margin-bottom: 30px;color: black;">Some title</h2>
                        <div style="height: auto;display:block;margin-bottom: 20px;background-color: white;">
                            <p style="color: black;">Here is some email text</p>
                        </div>';




    if(!$mail->send()) {
        echo 'Message could not be sent.';
        echo 'Mailer Error: ' . $mail->ErrorInfo;
    } else {
        echo 'Message has been sent';
    }

0 个答案:

没有答案