加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

在Windows 8上无法发送带有php邮件功能的邮件

发布时间:2020-12-14 04:33:18 所属栏目:Windows 来源:网络整理
导读:我已经在 windows 8上安装了wamp. 有错误: Warning: mail() [function.mail]: Failed to connect to mailserver at “localhost” port 25,verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set() in C:wampwwwmail.php on line 9
我已经在 windows 8上安装了wamp.

有错误:

Warning: mail() [function.mail]: Failed to connect to mailserver at
“localhost” port 25,verify your “SMTP” and “smtp_port” setting in
php.ini or use ini_set() in C:wampwwwmail.php on line 9

这里是简单的源代码:

<?php
// The message
$message = "Line 1rnLine 2rnLine 3";

// In case any of our lines are larger than 70 characters,we should use wordwrap()
$message = wordwrap($message,70,"rn");

// Send
mail('caffeinated@example.com','My Subject',$message);
?>

我必须通过php在Windows 8上安装哪些软件来发送电子邮件? sendmail,msmtp或ssmtp?

尝试这个

配置此设置

在php.ini

SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = my-gmail-id@gmail.com
sendmail_path = ""C:xamppsendmailsendmail.exe" -t"

在sendmail.ini中:

smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=my-gmail-id@gmail.com
auth_password=my-gmail-password
force_sender=my-gmail-id@gmail.com

Important: comment following line if there is another sendmail_path in the php.ini : sendmail_path="C:xamppmailtodiskmailtodisk.exe"

Note: Tested and works fine in my Windows 8.1

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读