The PHP mail () function needs to be configured to send mail Oh, the following configuration method
If you're not using Windows, then the Sendmail_path command is the only thing you have to worry about. If you are using Windows, you need to look at the last two instructions.
If you're using Linux or a UNIX variant, Sendmail_path should look like this:
Sendmail_path =/usr/sbin/sendmail
Or if you use QMail:
Sendmail_path =/var/qmail/bin/sendmail
In this instruction in the PHP mail () function, you can also set the configuration parameters to indicate the queue buffering option or the display setting Return-path header, as follows:
Sendmail_path =/usr/sbin/sendmail-t-fyou@yourdomain.com
As a non-Windows user, that's all you have to do. If you are using Windows, you have more things to do. You also need to look at the SMTP and Sendmail_from values. Don't be sendmail_. The sendmail in the from instruction name is confused. Although you do not use Windows on the name of the SendMail program, but that is only the names of instructions. Don't be frightened by it.
In the results of your phpinfo (), look at the default values for SMTP and Sendmail_from-they are either blank or contain random values. You should change them to meaningful values.
If you are determined to run an SMTP service program on this computer, your entry in the php.ini file should read as follows:
SMTP = localhost
However, if you want to use an outgoing mail server from your ISP (which is earthlink in this case), then the messages in php.ini should look like the following:
SMTP = Mail.earthlink.net
You can also use an IP address instead of a domain name because the computer does not distinguish between these two entries.
The second configuration directive is sendmail_from, which should be set to the e-mail address in the from header. It can be modified in the script but is usually used as the default value. Here is an example of this configuration Directive youraddress@ YourDomain.com refers to your own email address.
The code is as follows |
Copy Code |
Sendmail_from = youraddress@yourdomain.com |
Send a simple email:
The code is as follows |
Copy Code |
$txt = "A textnsecond line of text"; Use WordWrap () if lines are longer than $txt = WordWrap ($txt, 70); Send Email Mail ("somebody@example.com", "My subject", $txt); |
Just start feeling very good, NetEase mailbox, QQ mailbox, Gmail mailbox commonly used mailbox can receive, but after testing Hotmail, TOM, live and other mailboxes are not receive this kind of mail!
After the query mail sent, the general need for authentication, and PHP from the Mail () helpless, very fragile ah!