PHP Mail configuration

Source: Internet
Author: User
I want to use PHP to mail (yuan_ping@163.com sent to nnnnyyyy@21cn.com) according to some books write a piece of program, but the operation is not successful. Why? & Lt ;? Php // declare the email address as the receiving email address $ mailTo & quot; nnnnyyyy@21cn.com & quot; // subject...

I want to use PHP to mail (yuan_ping@163.com sent to nnnnyyyy@21cn.com) according to some books write a piece of program, but the operation is not successful. Why?


// Declare the email address as the receiving email address
$ MailTo = "nnnnyyyy@21cn.com ";
 
// Subject:
$ MailSubject = "Just a test Mail! ";


// Body of the email:
$ MailBody = "This is a test of PHP's mail function .";
$ MailBody = "It was generated by PHP version .";
$ MailBoyd. = phpversion ();


// Mail header:
$ MailHeaders = "From: yuan_ping@163.com ";


// Send an email
If (mail ($ mailto, $ mailSubject, $ mailBody, $ mailHeaders ))
{
Echo "Mail uccessfully sent! ";
}
Else
{
Echo "Error in sending mail! ";
}
?>


Failed to send.

 


You need to configure the smtp server


Windows 2000 users


Install and set the server


Windows XP and 2000 have the SMTP server component function, but they are not installed yet. Select "Control Panel> add/delete Programs> add/delete Windows components". in the displayed "Windows component wizard" dialog box, double-click "Internet Information Service (IIS, the detailed selection option is displayed. select "SMTP Service" and press "OK" to insert the Windows XP installation disk for installation.


 


After the SMTP server is installed, select "Control Panel> performance and maintenance> Management Tools> Internet information service" to open the Internet information service settings window, and click the name of the local computer on the left side of the window, expand the local computer directory and you will see two branches, Wed site and default SMTP virtual server ". Right-click "default SMTP virtual server" and choose "properties" to open the "default SMTP virtual server properties" window.


The general tab mainly sets the IP address. click "127.0.0.1" in the drop-down list to point to the IP address of the local computer. use the default settings for other items. If you have a fixed IP address for LAN access, you should select the corresponding IP address.


 


On the "access" tab, set the access permission. Click "authentication" and select "anonymous access", which means that any user can send the message. you do not need to select the other two items; click "interrupt" in "connection" and "Middle limit" in "connection control", and select "except the following list" to allow access by all users.


On the "mail" tab, set the mail transmission conditions and restrictions. you can use the default values for "limit mail size" and other four options without changing them;


"Sending copies of the non-delivered reports to" can return the failed emails to the sender and indicate the reason for the failure; "dead letter directory" sets the location where emails that fail to be sent are stored.


Set the mail delivery time in the "transmission" option. you do not need to modify it here, but use the default value. The "LDAP route" option is used to specify the directory server ID and attribute used by the server, and you do not need to start it here.


The "security" option sets the authorized user to use the sending server. the default user is "Administrators". you can click "add" to add a user.


After everything is set up, you will support your email sending server!

 

After SMTP is installed, you should find PHP in WINDOW2K. The INI file is in C: \ WINNT.
Open and find the following lines
[Mail function]
; For Win32 only.
SMTP = 10.0.0.9 ------- replace it with your IP address. 10.0.0.9 is an even IP address :)


; For Win32 only.
Sendmail_from = test@test.com --- sender information


Then restart APACHE
 

From Qinglong, Jupiter

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.