PHP sendmail function in IIS cannot send mail

Source: Internet
Author: User
Tags iis ini php file safe mode win32 wordpress blog

First you need to go to download the Sendmail.zip file from http://glob.com.au/sendmail/, click here to download it directly Oh, then unzip it to the d:/php/sendmail/directory.

Then open the php.ini file and find the following code

The code is as follows

[Mail Function]
; For Win32.
SMTP = localhost
Smtp_port = 25
; For Win32.
; sendmail_from = me@example.com
; For Unix only. You may supply arguments as OK (default: "Sendmail-t-i").
; Sendmail_path = ""
; Force The addition of the specified parameters to be passed as extra parameters
; to the SendMail binary. These parameters would always replace the value of
; The 5th parameter to mail (), even in safe mode.
; mail.force_extra_parameters =

By default, this is done as a mail server, where we need to borrow sendmail to send mail, with SendMail to configure such as QQ, 163 of the mailbox to send (generally in this way) so we need to put all the options are off, that is, the SMTP = localhost and smtp_port = 25 front plus ";" Then put the sendmai_path= "" in front of the ";" deleted, changed to Sendmai_path= "D:/php/sendmail/sendmail.exe-t", after the change is

The code is as follows

[Mail Function]
; For Win32.
; SMTP = localhost
; smtp_port = 25
; For Win32.
; sendmail_from = me@example.com
; For Unix only. You may supply arguments as OK (default: "Sendmail-t-i").
Sendmail_path = "D:/php/sendmail/sendmail.exe-t"
; Force The addition of the specified parameters to be passed as extra parameters
; to the SendMail binary. These parameters would always replace the value of
; The 5th parameter to mail (), even in safe mode.
; mail.force_extra_parameters =


Note that the above only needs to open Sendmail_path, and then save

Then modify the SendMail directory of the Sendmail.ini file, mainly filled with the following items

The code is as follows

SMTP_SERVER=SMTP server address (e.g. smtp.ym.163.com)
Auth_username= Mailbox Login name (such as info@xxxx.com)
Auth_password= mailbox password (such as XXXXXX)
Force_sender= Sender address complete (e.g. info@xxxx.com)

There is also another

The code is as follows

; Auto = use SSL for port 465, otherwise try to use TLS


Put the front of the ";" Delete, the SSL secure login option is turned on

The above four correct fill in the correction after the completion of the save, and then restart IIS to normal use, now very happy to test my WordPress blog


Now start debugging WordPress blog, but found that the server can not send mail, SendMail has been installed, but continue to prompt the message sent unsuccessful. Analyzed for a long time, finally found the reason

First step: Install SendMail Service
Download SendMail. RAR storage to the PHP directory of the SendMail directory


Step two, configure the php.ini file

The code is as follows


Sendmail_path = "D:/php/sendmail/sendmail.exe-t"


The drive letter and location are determined according to the Sendmail.exe file location

Step three, configure Sendemail.ini

The code is as follows


smtp_server=smtp.sina.com.cn
Smtp_port=25
These are the accounts that require verification, the password
Auth_username=ifbs
Auth_password=xxxx


Step fourth, give Cmd.exe permission
C:/windows/system32/cmd.exe files to read permissions for users. The following error will occur if you do not give permission.
Warning:mail () [Function.mail]: Could not execute mail delivery program

Step fifth, establish mail.php file test results

The code is as follows


<?php
$mail = "xxxx@sina.com.cn";
$subject = "Mail Test";
$text = "This is a test mail for function mail ()";

if (Mail ($mail, $subject, $text)) {
echo "Email send success!";
}else{
echo "Email send fail!";
}
?>

Access mail.php to test results

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.