What if we store the echo variable content in a variable? This post was last edited by u011552243 at 20:08:40
Php echo email
Problem background: I want to output a table and send it as content by email.
Problem: add the code first,
$message = '
'; $message.= 'Driver: '; $message.= $firstName.' '.$lastName; $message.= ' |
Date:'.$orderTime.' |
No: 1 |
Car'.$truck.':'.' '.$licNum; $message.= ' |
Kund:'.$customerName.' |
Order:'.$orderNum.' |
'; $message.= 'Book number:'.$bookNumPick.' |
Produktnamn:'.$productName.' |
Chassi:'; $message.= $tankName.' |
Tank number:'.$chassi.' |
Place:'.$locationPick.' |
Place 2:'; $message.= $portCodePick.' |
Place 3:'.$locationUnload.' |
Place 4:'; $message.= $timeUnload.' |
Place 5:'.$ADRclass.' |
Place 5:'.$weight.' |
Place 6:'; $message.= $locationLoad.' |
Place 7:'.$loadTime.' |
Place 8:'; $message.= ' |
'.$info.' |
Place 9:'.$outE.' |
Place 10:'.$bookNumOut.' |
Place 11:'; $message.= $portCodeOut.' |
|
'; echo $message."
"; $to = $email; $subject = "Task"; $from = EMAIL; $headers = "From: $from"; echo $headers."
"; mail($to,$subject,$message,$headers);
I used double quotation marks at first. later, to ensure that the content in $ message is kept in double quotation marks, I changed the outer double quotation marks to single quotation marks.
In fact, I want the email content to be the result of echo $ message. However, the mail () function is used to send $ message Directly. The result is:
.... (Omitted, visible $ message )..... |
|
Directly sends the content in $ message instead of the result after echo $ message.
What should I do?
Thank you very much for your convenience.
Reply to discussion (solution)
Problem background: I want to output a table and send it as content by email.
Problem: add the code first,
$message = '
'; $message.= 'Driver: '; $message.= $firstName.' '.$lastName; $message.= ' |
Date:'.$orderTime.' |
No: 1 |
Car'.$truck.':'.' '.$licNum; $message.= ' |
Kund:'.$customerName.' |
Order:'.$orderNum.' |
'; $message.= 'Book number:'.$bookNumPick.' |
Produktnamn:'.$productName.' |
Chassi:'; $message.= $tankName.' |
Tank number:'.$chassi.' |
Place:'.$locationPick.' |
Place 2:'; $message.= $portCodePick.' |
Place 3:'.$locationUnload.' |
Place 4:'; $message.= $timeUnload.' |
Place 5:'.$ADRclass.' |
Place 5:'.$weight.' |
Place 6:'; $message.= $locationLoad.' |
Place 7:'.$loadTime.' |
Place 8:'; $message.= ' |
'.$info.' |
Place 9:'.$outE.' |
Place 10:'.$bookNumOut.' |
Place 11:'; $message.= $portCodeOut.' |
|
'; echo $message."
"; $to = $email; $subject = "Task"; $from = EMAIL; $headers = "From: $from"; echo $headers."
"; mail($to,$subject,$message,$headers);
I used double quotation marks at first. later, to ensure that the content in $ message is kept in double quotation marks, I changed the outer double quotation marks to single quotation marks.
In fact, I want the email content to be the result of echo $ message. However, the mail () function is used to send $ message Directly. The result is:
.... (Omitted, visible $ message )..... |
|
Directly sends the content in $ message instead of the result after echo $ message.
What should I do?
Thank you very much for your convenience.
Solved by yourself. $ Headers = "From: $ from". "\ r \ n ";;
$ Headers. = "MIME-Version: 1.0 \ n". "Content-type: text/html; charset = UTF-8 '";
You can. Close the post.