我的邮件()用php工作我的emailmessage =
$email_bericht .= "
<table border='0' width='40%'>
<tr>
<td>Bedrijfsnaam</td>
<td>
".$naam."
</td>
</tr>
<tr>
<td>Risicoadres</td>
<td>
".$risicoadres."
</td>
</tr>
<tr>
<td>Adres</td>
<td>
".$adres."
</td>
</tr>
<tr>
<td>Woonplaats</td>
<td>
".$woonplaats."
</td>
</tr>
<tr>
<td>Relatienummer</td>
<td>
".$relatienummer."
</td>
</tr>
<tr>
<td>Aanhef</td>
<td>
".$aanhef."
</td>
</tr>
<tr>
<td>Contactpersoon</td>
<td>
".$contactpersoon."
</td>
</tr>
<tr>
<td>mailadres</td>
<td>
".$emailadres."
</td>
</tr>
<td>Jaar</td>
<td>
".$jaar."
</td>
</tr>
</table>";
在显示的电子邮件中:
<table border='0' width='40%'>
<tr>
<td>Bedrijfsnaam</td>
<td>
Bob
</td>
</tr>
<tr>
<td>Risicoadres</td>
<td>
Bobstreet 12
</td>
</tr>
<tr>
<td>Adres</td>
<td>
Bobstreet 12
</td>
</tr>
<tr>
<td>Woonplaats</td>
<td>
England
</td>
</tr>
<tr>
<td>Relatienummer</td>
<td>
123456
</td>
</tr>
<tr>
<td>Aanhef</td>
<td>
Dear guy
</td>
</tr>
<tr>
<td>Contactpersoon</td>
<td>
Bob
</td>
</tr>
<tr>
<td>mailadres</td>
<td>
BOB@bobbv.nl
</td>
</tr>
<td>Jaar</td>
<td>
2028
</td>
</tr>
</table>";
我的邮件()=
mail($email_naar, $email_onderwerp, $email_bericht);
mail($emailadres, $email_onderwerp, $email_bericht);
它显示已发送到电子邮件地址的邮件中的所有table / tr's / td等等以任何方式解决此问题我是否需要使用html标记或其他内容?
答案 0 :(得分:4)
如果发送没有标题信息的邮件,它将把table,tr,td作为字符串 你需要包括
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: '. $sendermail . "\r\n";
mail($to, $subject, $message, $headers)
答案 1 :(得分:1)
您需要设置
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
然后:
mail($email_naar, $email_onderwerp, $email_bericht, $headers);
答案 2 :(得分:1)
您需要在mail()调用中添加标头(第四个参数)
特别为您的目的而需要(与相关的charset)
'Content-type: text/html; charset=iso-8859-1'
;
请参阅http://php.net/manual/en/function.mail.php以了解有关在电子邮件中发送标题的详情。你需要其中一些,比如“回复”和其他一些
答案 3 :(得分:1)
我认为mail()
函数将邮件作为纯文本发送,不会呈现HTML部分。
以下是发送HTML电子邮件的示例程序。 (从php.net复制并粘贴)
<?php
// multiple recipients
$to = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';
// subject
$subject = 'Birthday Reminders for August';
// message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
?>