Home  >  Article  >  Backend Development  >  Detailed explanation of how PHP configures sendmail under windows and sends emails through the mail() function

Detailed explanation of how PHP configures sendmail under windows and sends emails through the mail() function

墨辰丷
墨辰丷Original
2018-05-21 13:49:421779browse

This article mainly introduces the method of configuring sendmail under Windows using PHP and sending emails through the mail() function. It analyzes the configuration steps and corresponding usage skills of sendmail on the Windows platform in more detail. Friends in need can refer to the following

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:

phpstudy uses the built-in sendmail extension to send emails

sendai iis The sendmail configuration method of the php mail function is officially recommended

The sendmail configuration method of the php mail function under iis (official recommendation) _PHP tutorial

The above is the detailed content of Detailed explanation of how 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