Super simple email sending program

Source: Internet
Author: User
I recently developed a News system. I wrote this small program to imitate the online mail function of various websites and hope it will be useful to Cainiao. I didn't give a part of the code, but only gave the key part. Shouxin represents the recipient's address, shouren represents the recipient's name, jixin represents the sender's address, and faren represents SyntaxHighlighter. all ();

I recently developed a News system. I wrote this small program to imitate the online mail function of various websites and hope it will be useful to Cainiao.
I didn't give a part of the code, but only gave the key part. Shouxin indicates the recipient's address, shouren indicates the recipient's name, jixin indicates the sender's address, and faren indicates the sender's name. Id is a parameter passed from the front. it is useless for you.
If ($ shouxin = "")
{
Echo "unable to send because there is no recipient address ";
} Else {
$ To = explode (, $ shouxin );
$ Tocount = count ($ );
$ Headers = "From:". $ jixin. "n ";
$ Subject = "receive ";
$ Body = "Hello. $ Shouren ";
$ Body. = "n ";
$ Body. = "your friend $ faren ";
$ Body. = "I recommend you submit an article http: // 127.0.01.1/myweb/biye/news/newsdetail. php? Id = $ id ";
$ Body. = "n ";
$ Body. = "$ content ";
For ($ I = 0; $ I <$ tocount; $ I ++ ){
If (mail ($ to [$ I], $ subject, $ body, $ headers ))
{
Echo "sent successfully! ";
} Else {
Echo "failed to send. please try again. ";
Exit ();}
}
}
?>

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.