Php php sendmail function can't send mail

  
                  

First you need to download the sendmail.zip file from http://glob.com.au/sendmail/, click here to download it, and extract 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 only. SMTP = localhost smtp_port = 25 ; For Win32 Only. ;sendmail_from = [email protected] ; For Unix only. You may supply arguments as well (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 will always replace the value of ; the 5th parameter to mail(), even in safe mode. ;mail.force_extra_parameters =


By default, this machine is used as a mail server. Here we need to borrow sendmail to send mail, use sendmail to configure it to send it with qq, 163 mailbox (usually in this way) so we need to put all the options. Log out, put SMTP = localhost and smtp_port = 25 in front of ";" and then delete the "" in front of sendmai_path="" to sendmai_path="d:/php/sendmail /sendmail.exe -t" After the change, the

code is as follows

[mail function] ; For Win32 only. ;SMTP = localhost ;smtp_port = 25 ; For Win32 only. ;sendmail_from = me@example. For Unix only. You may supply arguments as well (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 will 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 be turned on. Sendmail_path can be, then save

Then modify the sendmail.ini file in the sendmail directory, the main content is the following

Code is as follows

smtp_server=smtp server address (eg smtp.ym.163.com) auth_username=mailbox login name (eg [email protected]) auth_password=mailbox password (eg xxxxxx) force_sender=sender address is written (eg [email protected])


There is another

code as follows

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

Remove the previous ";", that is, enable the SSL secure login option.

The above four items are correct. Fill in the changes and save, then restart IIS to use normally, now I am 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 mail was not sent successfully. Analysis for a long time, finally found the reason

Step 1: Install the sendmail service Download sendmail.RAR to the sendmail directory under the php directory

Step 2, configure the php.ini file

Code is as follows

sendmail_path =”D:/php/sendmail/sendmail.exe -t”

The drive letter and location are determined by the location of the sendmail.exe file

The third step, configure sendemail.ini

The code is as follows

smtp_server=smtp.sina.com.cn smtp_port=25 These two are the account when authentication is required, password auth_username= Ifbs auth_password=XXXX

The fourth step is to give cmd.exe permission. The C:/WINDOWS/system32/cmd.exe file has the read permission of users. The following error will occur if you do not grant permission. Warning: mail() [function.mail]: Could not execute mail delivery program

Step 5: Create a mail.php file test result

Code is as follows

< ?php $mail = “[email protected]”; $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!”; } ?>

Visit mail. Php can test the results
More reference to solve the tutorial "iis php mail function sendmail configuration method"

Copyright © Windows knowledge All Rights Reserved