Home >Backend Development >PHP Tutorial >PHP configures sendmail under windows and sends emails through the mail() function

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

小云云
小云云Original
2018-02-12 13:07:232285browse

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

6. 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 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!

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