PHP configures sendmail under windows and sends emails through the mail() function

小云云
Release: 2023-03-20 10:02:02
Original
2149 people have browsed it

This article mainly introduces the method of PHP to configure sendmail under windows and send emails through the mail() function. It analyzes the configuration steps and corresponding usage skills of sendmail on Windows platform in more detail. Friends who need it can refer to it. Hope it helps everyone.

1. The php mail() function cannot be used in windows, and sendmail needs to be installed.

2. Download the sendmail component from http://glob.com.au/sendmail/

3. Unzip sendmail.zip to the directory. The path I installed is: F:\root \sendMail

4. Configure php.ini, mainly configure the following three items

##5. Modify sendmail.ini, file path: F:\root\ sendMail\sendmail.ini

smtp_server=smtp.qq.com
smtp_port=25
auth_username=yourusername
auth_password=yourpassword
force_sender=******@qq.com
Copy after login

6. Test sending mail

<?php
if(mail("test@test.com","测试","测试邮件")){
 echo "success";
} else {
  echo "fail";
}
Copy after login

Related recommendations:

Solve several problems often encountered when using the mail() function

##Usage of the mail() function and SMTP in php Detailed explanation of working principle

10 recommended articles about php Mail() function

The above is the detailed content of PHP configures sendmail under windows and sends emails through the mail() function. 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
Popular Tutorials
More>
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!