Phppearmail email sending instance -- & gt; & lt ;! Doctypehtmlpublic & quot;-w3cdtdxhtml10transitionalen & quot; http: wwww3orgtrxhtml1dtdxhtml1-transi
Phppear mail sending email instance
- -->
-
-
- Php sends emails
-
-
-
-
-
-
-
-
- Require_once 'mail. php ';
- $ Conf ['mail'] = array (
- 'Host' => 'smtp .126.com ', // smtp server address
- 'Auth' => true, // true indicates that the smtp server needs to be verified, and false does not.
- 'Username' => 'liangbowen ', // User name
- 'Password' => '******' // password
- );
-
- // Send an email
- $ Headers ['from'] = 'liangbowen @ 126.com '; // mail address
- $ Headers ['to'] = 'liangbowen @ hotmail.com '; // recipient address
- $ Headers ['subobject'] = 'Test mail send by php bowen.mvbb.com '; // mail title
- $ Mail_object = & mail: factory ('smtp ', $ conf ['mail']);
- // Body of the email
- $ Body = "this is an email sent to you. ";
- $ Mail_res = $ mail_object-> send ($ headers ['to'], $ headers, $ body); // send
- If (pear: iserror ($ mail_res) {// Check the error
- Die ($ mail_res-> getmessage ());
- }
- Else {
- Echo "send successful! ";
- }