SMTP脚本不发送邮件

此脚本未发送邮件,我使用ptc脚本。这样可以将用户激活邮件发送到收件箱。

<?php
class Mail {
function mail() {
    global $db;
    global $cache;

    $mail_settings = $cache->get("mail_settings");

    if ($mail_settings == null) {
        $query = $db->query("SELECT * FROM mail_settings");

        while ($result = $db->fetch_array($query)) {
            $mail_settings[$result['field']] = $result['value'];
        }

        $cache->set("mail_settings",$mail_settings,604800);
    }

    $this->mail_settings = $mail_settings;
    $this->mail = new PHPMailer();

    if ($this->mail_settings['email_type'] == "smtp") {
        $this->mail->IsSMTP();
        $this->mail->SMTPAuth = true;
        $this->mail->SMTPSecure = $this->mail_settings['smtp_ssl'];
        $this->mail->Host = $this->mail_settings['smtp_host'];
        $this->mail->Port = $this->mail_settings['smtp_port'];
        $this->mail->username = $this->mail_settings['smtp_username'];
        $this->mail->Password = $this->mail_settings['smtp_password'];
    }

}

function setfrom($from_email = null,$name = null) {
    if (!empty($from_email)) {
        $this->from = $this->mail_settings['email_from_address'];
        $this->from_name = $this->mail_settings['email_from_name'];
    }
    else {
        $this->from = $from_email;

        if ($name == "") {
            $this->from_name = $this->from;
        }
        else {
            $this->from_name = $name;
        }
    }

    $this->mail->setfrom($this->from,$this->from_name);
    $this->mail->AddReplyTo($this->from,$this->from_name);
}

function addTo($to_email,$to_name = null) {
    $this->to = $to_email;

    if ($to_name == "") {
        $this->to_name = $this->to;
    }
    else {
        $this->to_name = $to_name;
    }

    $this->mail->AddAddress($this->to,$this->to_name);
}

function setSubject($subject) {
    $this->mail->Subject = $subject;
}

function setBodyText($message) {
    $this->mail->ContentType = "text/plain";
    $this->mail->IsHTML(false);
    $this->mail->Body = $message;
}

function setBodyHtml($message) {
    $this->mail->AltBody = "To view the message,please use an HTML compatible email viewer!";
    $this->mail->MsgHTML(stripslashes($message));
}

function send() {
    if (!$this->mail->Send()) {
    }
 }
}

require ROOTPATH . "includes/classes/class_refcron.php";
?>

当我发送“提交”按钮时,仅加载该按钮。没有错误代码显示。请您能帮我用smtp解决此发送邮件功能吗?我也使用php mailer发送邮件。没有smtp设置邮件发送完美,但是当我使用smtp gmail发送邮件或托管邮件时,它什么也不发送或没有错误显示。我很累,甚至更改了phpmailer版本,但没有用。

iCMS 回答:SMTP脚本不发送邮件

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2149598.html

大家都在问