简体   繁体   English

xampp php发送邮件

[英]xampp php send mail

I searched on stackoverflow and google to find how to setup xampp , mercury and php code to send mail with window server 2008 r2. 我搜索stackoverflow和谷歌找到如何设置xamppmercuryphp代码发送邮件与窗口服务器2008年r2。

And with tutorial found out I can send mail by using Mail::factory with smtp.gmail.com , and also can send mail by using Mercury ( File -> Send mail message ) with my_email_address@my_domain_name.com registered in Mercury. 通过教程发现我可以使用带有smtp.gmail.com Mail::factory发送邮件,也可以使用Mercury中注册的my_email_address@my_domain_name.com Mercury文件 - > 发送邮件消息发送邮件 So I try to send mail by using php code. 所以我尝试使用php代码发送邮件。 But it is sill not working in my case. 但在我的情况下,它不起作用。

Here are my configs: 这是我的配置:

C:/xampp/apache/php.ini C:/xampp/apache/php.ini

sendmail_path = "\xampp\sendmail\sendmail.exe -t -i"

sendmail.ini sendmail.ini

smtp_server=my_domain_name.com
smtp_port=25
error_logfile=error.log
debug_logfile=debug.log
auth_username=my_email_address@my_domain_name.com
auth_password=my_password
force_sender=my_email_address@my_domain_name.com
hostname=my_domain_name.com

code php 代码php

$to = $email;
$subject = "Hello";
$message = "How are you ?";
$from = "my_email_address@my_domain_name.com";
$headers = "From:" . $from;
$result = mail($to,$subject,$message,$headers);

if($result){
    echo "Mail Sent." . $result;
}
else{
    echo "Failure." . $result;
}

I check in C:\\xampp\\sendmail\\debug.log and get error 我检查C:\\xampp\\sendmail\\debug.log并得到错误

--- MESSAGE END ---
12/12/31 06:46:04 ** Connecting to my_domain_name.com:25
12/12/31 06:46:06 ** Disconnected.
12/12/31 06:46:06 ** Disconnected.
12/12/31 06:46:06 ** Disconnected.
12/12/31 06:46:06 ** Socket Error # 10061<EOL>Connection refused.

where am I wrong ? 我哪里错了? Would you please here help me ? 你能帮我吗?

Most time is the problem the ip of the server. 大部分时间是服务器的IP问题。 Because most provider dont allow traffic from dynamic ips, from servers with no god spf record ... 因为大多数提供商不允许来自动态ips的流量,来自没有神spf记录的服务器......

A solution would be, make a gmail account, and forward all traffic over gmail or an house internal exchange server. 一个解决方案是,建立一个Gmail帐户,并通过gmail或内部交换服务器转发所有流量。 XAMPP Sendmail using Gmail account XAMPP Sendmail使用Gmail帐户

Please follow instructions as mentioned in following link:- 请按照以下链接中的说明进行操作: -

http://system66.blogspot.com/2010/01/how-to-send-mail-from-localhost-with.html http://system66.blogspot.com/2010/01/how-to-send-mail-from-localhost-with.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM