Another solution for MAIL in PHP _ PHP Tutorial

Source: Internet
Author: User
Another solution for MAIL in PHP. Some time ago, I came into contact with DECTru64Unix. I installed PHP + APACHE on it. I can use the provided mail function to send emails normally, so I compiled a function, it uses the UNIX pipeline and some time ago I came into contact with DEC Tru64 Unix. I installed PHP + APACHE on it, and the mail function provided can never send emails normally, therefore, a self-developed function that uses a UNIX pipeline and php sock function to send emails. the experiment was very successful. below is the original code of this function.
Function mymail ($ mto, $ mcc, $ msubject, $ mbody)
{
$ From = "webmaster@backhome.com.cn ";
$ Sign = "\ n"; // whatever you want
$ Sendmailpath = "/usr/lib/sendmail"; // Semdmail path
$ Bound = "=======_". uniqid ("BCFMail"). "==_"; // delimiter
$ Headers = "MIME-Version: 1.0 \ n ".
"Content-Type: multipart/mixed; boundary = \" $ bound \ "\ n ".
"Date:". date ("D, d m h: I: s Y"). "\ n ".
"From: $ from \ n ".
"To: $ mto \ n ".
"Cc: $ mcc \ n ".
"Subject: $ msubject \ n ".
"Status: \ n ".
"X-Status: \ n ".
"X-Mailer: MY Email Interface \ n ".
"X-Keywords: \ n ";
$ Content = "--". $ bound. "\ n ". "Content-Type: text/plain; charset = \" GB2312 \ "\ n ". $ mbody. $ sign. "\ n ";
$ End = "\ n". "--". $ bound. "-- \ n ";
$ Sock = popen ("$ sendmailpath-t-f 'webmaster @ backhome.com.cn '", 'w ');
Fputs ($ sock, $ headers );
Fputs ($ sock, $ content );
Fputs ($ sock, $ end );
Fputs ($ sock, ". \ n ");
Fputs ($ sock, "QUIT \ n ");
Pclose ($ sock );
}

Unzip Tru64 Unix I installed PHP + APACHE on it. I can use the provided mail function to never send emails normally. so I compiled a function that uses UNIX pipelines and...

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.