邮件功能发送电子邮件

邮件功能发送电子邮件

本文介绍了无法在 Windows 8 上使用 php 邮件功能发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在 Windows 8 上安装了 wamp.

出现错误:

警告:mail() [function.mail]:无法连接到邮件服务器本地主机"端口 25,验证您的SMTP"和smtp_port"设置php.ini 或在 C:wampwwwmail.php 第 9 行使用 ini_set()

这是简单的源代码:

我必须安装哪些软件才能通过 Windows 8 上的 php 发送电子邮件?sendmail、msmtp 还是 ssmtp?

解决方案

试试这个

配置此设置

php.ini

SMTP=smtp.gmail.comsmtp_port=587sendmail_from = [email protected]_path = ""C:xamppsendmailsendmail.exe" -t"

sendmail.ini中:

smtp_server=smtp.gmail.comsmtp_port=587error_logfile=error.logdebug_logfile=debug.logauth_username=my-gmail-id@gmail.comauth_password=my-gmail-passwordforce_sender=my-gmail-id@gmail.com

重要提示:如果 php.ini 中还有另一个 sendmail_path ,请注释以下行:sendmail_path="C:xamppmailtodiskmailtodisk.exe"

注意:在我的 Windows 8.1 中测试并正常运行

I have installed wamp on windows 8.

Got error:

Here is the simple source code:

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

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

// Send
mail('[email protected]', 'My Subject', $message);
?>

Which software do i have to install to email through php on windows 8? sendmail, msmtp or ssmtp?

解决方案

Try this

Configure This Setups

in php.ini

SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = [email protected]
sendmail_path = ""C:xamppsendmailsendmail.exe" -t"

in sendmail.ini:

smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
[email protected]
auth_password=my-gmail-password
[email protected]

这篇关于无法在 Windows 8 上使用 php 邮件功能发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 19:34