【问题标题】:SMTP server response: 550 apache php mail serverSMTP 服务器响应:550 apache php 邮件服务器
【发布时间】:2012-09-20 06:43:02
【问题描述】:

我收到此错误消息

警告:mail() [function.mail]:SMTP 服务器响应:550-请 在您的邮件客户端中打开 SMTP 身份验证,或登录到 550-IMAP/POP3 服务器在发送您的消息之前。 (sgs5.aws.lan) 550-[212.199.198.158]:7165 不允许通过此中继 服务器 550 没有身份验证。在 C:\程序 Files\Zend\Apache2\htdocs\PPC-Advert-System\Results\DebuggerFinalResultDB.php 在第 32 行。

代码可以在我的电脑上运行,但是当我把它放到另一台电脑上时它就不行了。我不知道配置中的问题在哪里。这是我设置 php.ini 要做的事情:

   ini_set("SMTP","mail.me.com" );
ini_set("smtp_port","25" );
ini_set("auth_username","username" );
ini_set("auth_password","pass" );

然后我使用这个函数:

    private function send_an_email($to,$file="",$message="") {
    $subject = 'PCC-Advert-System';
    $message =  $message."<br/><br/><br/>Time Finished Scaning:<br/><br/><br/> ".date('l jS \of F Y h:i:s A')."\r\n Ratio: \r\n".$this->ratio." \r\nFile Path:<br/> <a href='http://212.199.198.158/PPC-Advert-System/FileStorage/$file'>http://212.199.198.158/PPC-Advert-System/FileStorage/$file</a><br/><br/><br/><a href='".$this->debug_file."'>$this->debug_file </a> ";//.$this->file;
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers.= 'From: scriptspc@bso.com' . "\r\n" .
            'Reply-To: scriptspc@bso.com' . "\r\n" .
            'X-Mailer: PHP/' . phpversion();
    mail($to, $subject, $message, $headers);
    echo "<br/><br/><h1>Email has been sent</h1>";
}

【问题讨论】:

  • 如果你想使用自定义的 SMTP,你应该使用类似 PHPMailer 的东西,使用 mail() 和 SMTP 发送电子邮件是很困难的。
  • 该解决方案有效..在我的电脑上..但在另一台电脑上却不行。我想查明问题。我对使用其他代码不感兴趣
  • 好吧..phpmailer..似乎工作..谢谢
  • 很高兴你做出了这个决定,简单的mail() 函数是一种痛苦和时间消耗。

标签: php apache email


【解决方案1】:

如果您想使用自定义 SMTP,您应该使用 PHPMailer 之类的东西,使用 mail()SMTP 发送电子邮件很困难。

然后你可以定义应该使用什么 SMTP。

【讨论】:

    猜你喜欢
    • 2012-04-16
    • 2013-02-15
    • 1970-01-01
    • 1970-01-01
    • 2014-03-08
    • 2014-11-15
    • 1970-01-01
    • 2020-06-14
    • 2019-06-14
    相关资源
    最近更新 更多