用WAMP发送电子邮件 [英] Sending emails with WAMP

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

问题描述

我使用最新的WAMP,当我尝试发送电子邮件时,我得到这个:

I use the latest WAMP and I get this when I try to send emails:

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:\wamp\www\main\createaccount.php on line 8

邮件传递失败...

消息:

$to = "xxx@hotmail.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
  echo("<p>Message successfully sent!</p>");
 } else {
  echo("<p>Message delivery failed...</p>");
 }

您还需要下载mailserver吗?

Do you need do download a "mailserver" also?

请帮助。

推荐答案

这对我有用,应该适合你:使用<一个href =http://glob.com.au/sendmail/ =noreferrer> Fake Sendmail 和一个webhost邮件服务器(即 - Godaddy,1and1等)。

This works for me and should work for you: Use Fake Sendmail and a webhost mail server (i.e. - Godaddy, 1and1, etc.).

1。)下载sendmail zip并将其解压缩到C:\Wamp\bin\sendmail(为了这个例子的目的)。

1.) Download the sendmail zip and extract it to C:\Wamp\bin\sendmail (for purposes of this example).

2。)编辑C:\wamp\bin\sendmail\sendmail.ini并将以下内容设置为您的邮件服务器的要求(我的以下):

2.) Edit C:\wamp\bin\sendmail\sendmail.ini and set the following to your mail server's requirements (mine are below):

smtp_server=mail.yourdomain.com
smtp_port=26
smtp_ssl=none
;default_domain=yourdomain.com
auth_username=smtpuser@yourdomain.com
auth_password=smtppassword
;pop3_server=
;pop3_username=
;pop3_password=
;force_sender=
;force_recipient=

3。)设置拍h的sendmail.exe在您的php.ini文件中。

3.) Set the path of sendmail.exe in your php.ini file.

[mail function]
; For Win32 only.
SMTP =

; For Win32 only.
sendmail_from =

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = "C:\wamp\bin\sendmail\sendmail.exe -t"

4。)重新启动Wampserver。

4.) Restart Wampserver.

您可能会使用Gmail获得成功,但有一些额外的调整可以使其正常工作。我更喜欢使用我上传我的代码的webhost的邮件服务器。

You might have success using Gmail, but there are a few extra tweaks to make it work. I prefer using the mail server of the webhost where I upload my code.

这篇关于用WAMP发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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