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