Use the mail function in php to send HTML mail instances. In php, the email sending function mail () is provided. we can use this function to send emails directly. below I will introduce some common email sending instances. The simplest is the mail function. In php, the email sending function mail () is provided. we can use this function to send emails directly. below I will introduce some common email sending instances. The simplest is the mail function.
Example
The code is as follows: |
|
Function send_mail ($ from, $ to, $ subject, $ message) { If ($ from = "") { $ From = 'recalling the future '; // Sender address } $ Headers = 'Mime-Version: 100'. "rn "; $ Headers. = 'content-type: text/html; charset = gb2312 '. "rn "; $ Headers. = 'from: '. $ From. "rn "; Mail ($ to, $ subject, $ message, $ headers ); } ?> |
Prompt
The program to be used is defined by the configuration settings in the php. ini file. the behavior of the Mail function is affected by php. ini. we must configure it first.
The default name description can be changed.
SMTP "localhost" for Windows: The DNS name or IP address of the SMTP server. PHP_INI_ALL
Smtp_port "25" for Windows: SMTP segment slogan. Available from PHP 4.3. PHP_INI_ALL
Sendmail_from NULL for Windows: specifies the "from" address used in emails sent from PHP. PHP_INI_ALL
Sendmail_path NULL dedicated for Unix systems: specifies the sendmail program path (usually/usr/sbin/sendmail or
/Usr/lib/sendmail) PHP_INI_SYSTEM
You can use this function to send emails directly. next I will introduce some common email sending instances. The simplest is the mail function ....