PHP的电子邮件不工作的错误 [英] Php email not working error

查看:223
本文介绍了PHP的电子邮件不工作的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的XAMPP 1.7.4(PHP 5.3.5),当我发送电子邮件到我的电子邮件地址其工作。甚至我所用的邮件服务器作为其不工作的例子。下面是code。

 < PHP
    的ini_set(SMTP,mail.sweetinteractive.com);
    $ SUC =电子邮件(uzair@sweetinteractive.com,学习PHP,消息不工作,来源:uzair@sweetinteractive.com);
    如果($ SUC){
        回声邮件发送;
    }其他{
        回声邮件发送失败。
    }
?>

甚至让我尝试了我们的邮件服务器的工作。但其显示和误差

 警告:电子邮件()[function.mail]:SMTP服务器响应:550访问被拒绝 - 无效HELO域名(见RFC2821 4.1.1.1)在C:\\ XAMPP \\ htdocs中\\ LearnPhp \\ email1.php第3行


解决方案

请先将php.ini并sendmail.ini文件夹的XAMPP

第一:需要改变域在php.ini(ROOTDRIVE:\\ XAMPP \\ PHP \\ php.ini中)


(注:分号;在INI文件标志着一个评论)

  [邮件功能]
;对于Win32只。
; http://php.net/smtp
SMTP = mail.sweetinteractive.com
; http://php.net/smtp-port
SMTP_PORT = 25;对于Win32只。
; http://php.net/sendmail-from
sendmail_from = uzair@sweetinteractive.com

第二步:改变sendmail.ini文件(根目录:\\ XAMPP \\ sendmail的\\ sendmail.ini)


请注意:删除分号(;)的形式在以下领域
并在sendmail.ini文件的修改

  smtp_server = mail.sweetinteractive.com; SMTP端口(通常为25)SMTP_PORT = 25auth_username=uzair@sweetinteractive.com
AUTH_PASSWORD =在这里给您的密码不带任何引号

我相信这应该要去工作。因为你不提供在previous后的任何身份验证的参数。

注意:使在php.ini和sendmail.ini文件更改后,停止XAMPP控制面板Apache服务,并再次运行

和你的PHP code


 < PHP
    的ini_set(SMTP,mail.sweetinteractive.com);
    $ SUC =电子邮件(uzair@sweetinteractive.com,学习PHP,送信息将现在的工作,来源:uzair@sweetinteractive.com);
    如果($ SUC){
        回声邮件发送;
    }其他{
        回声邮件发送失败。
    }
?>

I am using xampp 1.7.4 (PHP 5.3.5) and when i send emails to my email address its working. and even i used mail server as examples its not working. below is the code.

<?php
    ini_set("SMTP","mail.sweetinteractive.com");
    $suc = mail("uzair@sweetinteractive.com","Learning PHP","Message is not working ","From: uzair@sweetinteractive.com");
    if($suc){
        echo "Mail sent";
    } else {
        echo "Mail sending Failed.";
    }
?>

And even i tried out working with our mail server. But its showing and error

Warning: mail() [function.mail]: SMTP server response: 550 Access denied - Invalid HELO name (See RFC2821 4.1.1.1) in C:\xampp\htdocs\LearnPhp\email1.php on line 3

解决方案

Please configure your php.ini and sendmail.ini files in xampp folder.

First : need to change the fields in php.ini (rootdrive:\xampp\php\php.ini)


(Note : semicolon ';' signifies a comments in ini files)

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = mail.sweetinteractive.com
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = uzair@sweetinteractive.com

second step : change the sendmail.ini file (rootdirectory:\xampp\sendmail\sendmail.ini)


note : remove semicolon (;) form give below fields and make changes in sendmail.ini file

smtp_server=mail.sweetinteractive.com

; smtp port (normally 25)

smtp_port=25

auth_username=uzair@sweetinteractive.com
auth_password=give your password here without any quotes

I believe this should gonna work. Because you are not providing any authentication parameters in previous post.

Note : after making the changes in php.ini and sendmail.ini files, stop the apache service from Xampp control panel and run it again.

and your php code


<?php
    ini_set("SMTP","mail.sweetinteractive.com");
    $suc = mail("uzair@sweetinteractive.com","Learning PHP","Message sending will work now","From: uzair@sweetinteractive.com");
    if($suc){
        echo "Mail sent";
    } else {
        echo "Mail sending Failed.";
    }
?>

这篇关于PHP的电子邮件不工作的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆