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

王林
Release: 2023-03-03 20:34:01
Original
3204 people have browsed it

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"
Copy after login

(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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!