php利用mail()发送邮件

linux利用sendmail发送邮件,win下可以php的mail函数。

mail函数不支持esmtp协议,只能直投,不能登录


以mail函数,163邮箱为例:

1)查询163邮件服务器的地址

nslookup -q=mx 163.com

wKiom1aCF_zRMcGdAABBGMnftxg251.png

2)把该地址写到php.ini里去:

[mail function]

; For Win32 only.

; http://php.net/smtp

; SMTP = localhost

SMTP = mx3.qq.com  //qq邮箱服务器

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

smtp_port = 25


; For Win32 only.

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

sendmail_from = [email protected]


mail()怎么发不出去?



http://help.163.com/09/1224/17/5RAJ4LMH00753VB8.html

也可以使用qq邮箱

会有拦截的可能。


二。也可以使用在本机上安装smtp服务器,可以不要每次修改php.ini


[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]



bestsmtpsrv.zip





你可能感兴趣的:(mail)