In PHP with the mailbox Send function mail () we can directly use this function to send mail, let me introduce some of the commonly used mailbox send instance, the simplest is the mail function.
Cases
The code is as follows |
Copy Code |
function Send_mail ($from, $to, $subject, $message) { if ($from = = "") { $from = ' Remembering the future ';//Sender Address } $headers = ' mime-version:1.0 '. "RN"; $headers. = ' content-type:text/html; charset=gb2312 '. "RN"; $headers. = ' From: '. $from. "RN"; Mail ($to, $subject, $message, $headers); } ?> |
Tips
The program to be used is defined by the configuration settings in the php.ini file, and the behavior of the mail function is affected by the php.ini, which we must first configure.
Name default description can be changed
SMTP "localhost" Windows-specific: The DNS name or IP address of the SMTP server. Php_ini_all
Smtp_port Windows Exclusive: SMTP segment number. Available from PHP 4.3. Php_ini_all
Sendmail_from NULL for Windows Exclusive: Specifies the "from" address to be used in messages sent from PHP. Php_ini_all
Sendmail_path NULL Unix System-specific: Specifies the path to the SendMail program (usually/usr/sbin/sendmail or
/usr/lib/sendmail) Php_ini_system
http://www.bkjia.com/PHPjc/445294.html www.bkjia.com true http://www.bkjia.com/PHPjc/445294.html techarticle in PHP with the mailbox Send function mail () we can directly use this function to send mail, let me introduce some of the commonly used mailbox send instance, the simplest is the mail function. ...