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 ();}
}
}
?>