Send form content in PHP email (9)-Buliding the message body

Source: Internet
Author: User
Tags php email

This section only has one content, is uses the user to fill in the content automatic production our mail content, certainly also carries on a series of judgments.

The content of the subject of the message is implemented by the following code, which can be understood in the comments:

1 if(!$suspect&&!$missing&&!$errors){//If this happens, we do not want this program to run;2     $message= ";//first set up $message and then slowly add content to the inside;3     foreach($expected  as $item){//To be cautious, I just want the content to appear in the subject of the message4         if(isset($$item) &&!Empty($$item)){5             $val= $$item;//variable variable, specific to the example, is $val = $name/$val = $email, etc.;6}Else {7             $val= ' not checked ';//This basically does not appear, because the front $missing and $errors have been verified. 8         }9         Ten         if(Is_array($val)){//handling input values is an array of cases One             $val=implode(‘, ‘,$val); A         } -         $item=Str_replace(Array(‘_‘,‘-‘),‘ ‘,$item);//remove dashes or dashes if e-mail becomes e mail -         $message.=Ucfirst($item) . ":$val\r\n\r\n ";//capitalize the initial letters, these are small deals that can be slowly replenished after large logic has been completed the     } -         $message=WordWrap($message, 70);//This is the mail request, the single line cannot exceed 70 characters; -      -      + //$message = ' This is the entire contents of the message '; -     $mailSended=true; +}Else{ A     $mailSended=false;//If you define this, do not fill in anything after clicking Submit, at //Will prompt for undefined $mailsended in form.php, - //Because we used it there to display the last message to verify that the message was sent successfully, - //But other methods will be used on the remote server.  -}

Send form content in PHP email (9)-Buliding the message body

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.