wamp服务器发送邮件,如何从本地WAMP服务器发送电子邮件发送电子邮件Gmail Hotmail等?...

本文指导如何修改php.ini文件,将PHP的邮件功能从localhost切换到使用SMTP服务器,特别是针对XAMPP或WAMP环境。首先备份php.ini,然后找到并更改[mailfunction]部分,将SMTP服务器设置为ISP的名称,保持smtp_port为25,并将sendmail_from设置为你的域名电子邮件地址。另外,提到了使用Gmail服务器进行SMTP身份验证的替代方案。
摘要由CSDN通过智能技术生成

a) Open the "php.ini". For XAMPP,it is located in C:\XAMPP\php\php.ini. Find out if you are using WAMP or LAMP server. Note : Make a backup of php.ini file

b) Search [mail function] in the php.ini file.

You can find like below.

[mail function]

; For Win32 only.

; http://php.net/smtp

SMTP = localhost

; http://php.net/smtp-port

smtp_port = 25

; For Win32 only.

; http://php.net/sendmail-from

;sendmail_from = [email protected]

Change the localhost to the smtp server name of your ISP. No need to change the smtp_port. Leave it as 25. Change sendmail_from from [email protected] to your domain email address which will be used as from address..

So for me, it will become like this.

[mail function]

; For Win32 only.

SMTP = smtp.planetghost.com

smtp_port = 25

; For Win32 only.

sendmail_from = [email protected]

auth_username = [email protected]

auth_password = example_password

c) Restart the XAMPP or WAMP(apache server) so that changes will start working.

d) Now try to send the mail using the mail() function ,

mail("[email protected]","Success","Great, Localhost Mail works");

================================= ===============================================

另一种方式

Gmail服务器在SSL下使用SMTP身份验证。我认为这是没有办法用在该情况下mail()函数,所以你可能要检查这些替代品:

它们都支持SMTP认证下SSL。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值