[英]How to configure XAMPP PHP to send mail from localhost via secure smtp my ISP
For sending email I normaly use Windows 7 Thunderbird with configuring secure SMTP via my ISP (ie login and password for SMTP server).对于发送电子邮件,我通常使用 Windows 7 Thunderbird 通过我的 ISP 配置安全 SMTP(即 SMTP 服务器的登录名和密码)。 Connection security: none, Password transmited insecurely.
连接安全性:无,密码传输不安全。 Mails are send OK.
邮件发送正常。
I tried configure XAMPP php.ini我尝试配置 XAMPP php.ini
[mail function]
SMTP=*my_isp_smtp_server*
smtp_port=25
sendmail_from=*my_email_address*
sendmail_path="\"c:\xampp\sendmail\sendmail.exe\" -t"
mail.add_x_header = Off
and sendmail.ini和 sendmail.ini
smtp_server=*smtp_server.my.isp*
smtp_port=25
error_logfile=error.log
debug_logfile=debug.log
auth_username=*login_to_my_isp_smtp_server*
auth_password=*password_to_my_isp_smtp_server*
force_sender=*my_email_address*
In my php script I use standard php function:在我的 php 脚本中,我使用标准 php 函数:
mail($recipient, $subject, $message, $headers);
I get no error message, but mail is not delivered.我没有收到错误消息,但邮件未送达。 Please could you help me anyone?
请问有人能帮帮我吗?
For everyone still struggling with this issue while looking for a solution, using sendmail package, you can configure it to use SMTP secure servers like gmail .对于在寻找解决方案时仍在努力解决此问题的每个人,使用sendmail包,您可以将其配置为使用gmail等SMTP安全服务器。 For simplicity I will show down below an example using gmail servers, but you can set your own SMTP server using hMailServer .
为简单起见,我将在下面展示一个使用 gmail 服务器的示例,但您可以使用hMailServer设置自己的 SMTP 服务器。 Documentation is availablehere and it uses port 465 for TLS .
文档可在此处获得,它使用端口465进行TLS 。 You just need to change, from the following gmail configuration, the SMTP server , port , address and password .
您只需从以下 gmail 配置中更改SMTP 服务器、端口、地址和密码。 The structure stays the same.
结构保持不变。
If you want to go for gmail route, as an example, check these parameters here :例如,如果您想使用 gmail 路由,请在此处检查这些参数:
Understood so, make the following changes:明白了,做如下修改:
In C:\xampp\php\php.ini
uncomment extension=php_openssl.dll
and restart Apache to add SSL support.在
C:\xampp\php\php.ini
中取消注释extension=php_openssl.dll
并重新启动 Apache以添加SSL支持。 Also change these values as in the documentation guide and set sendmail_from
accordingly:还可以按照文档指南中的方式更改这些值并相应地设置
sendmail_from
:
SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = yourgmailaddress@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
And in C:\xampp\sendmail\sendmail.ini
mirror these changes:在
C:\xampp\sendmail\sendmail.ini
中镜像这些更改:
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
auth_username=yourgmailaddress@gmail.com
auth_password=yourgmailpassword
force_sender=yourgmailaddress@gmail.com
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.