Home  >  Article  >  Backend Development  >  What should I do if I cannot send emails using the mail() function in php?

What should I do if I cannot send emails using the mail() function in php?

王林
王林Original
2020-08-05 14:29:203266browse

The solution to the problem of not being able to send emails using the mail() function in php: first download sendmail and decompress it; then open the php.ini configuration file and edit the "mail function" module; finally edit the sendmail.ini configuration file and set Just email information.

What should I do if I cannot send emails using the mail() function in php?

Cause analysis: The

mail() function cannot be used directly in Windows systems, and you need to download sendmail.

(Recommended tutorial: php graphic tutorial)

Solution:

First download sendmail, decompress it, and customize the path, for example: E :\sendmail;

Then add the following configuration to the php.ini configuration file (take 163 mailbox as an example);

[mail function]
SMTP = smtp.163.com
smtp_port = 25
sendmail_from = 4u4v@163.com
sendmail_path = "E:\sendmail\sendmail.exe -t"

(Video tutorial recommendation: php video tutorial )

Then modify the sendmail.ini file;

smtp_server=smtp.163.com  //这里是配置对应的163的smtp
smtp_port=25
auth_username=username  //邮箱用户名
auth_password=password   //邮箱密码
force_sender=username@163.com //你的邮箱全名 用户名@163.com

Done!

The above is the detailed content of What should I do if I cannot send emails using the mail() function in php?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to clear bom in phpNext article:How to clear bom in php