Home > Article > Backend Development > PHP configures sendmail under windows and sends emails through the mail() function
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.inismtp_server=smtp.qq.com smtp_port=25 auth_username=yourusername auth_password=yourpassword force_sender=******@qq.com6. Test sending mail
<?php if(mail("test@test.com","测试","测试邮件")){ echo "success"; } else { echo "fail"; }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 principle10 recommended articles about php Mail() functionThe 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!