Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php直接在邮件中发送代码_Php_Html_Email - Fatal编程技术网

php直接在邮件中发送代码

php直接在邮件中发送代码,php,html,email,Php,Html,Email,可能重复: 我用php处理我的电子邮件= $email_bericht .= " <table border='0' width='40%'> <tr> <td>Bedrijfsnaam</td> <td> ".$naam." </td>

可能重复:

我用php处理我的电子邮件=

$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>";

它显示已发送到电子邮件地址的邮件中的所有表/tr/td等。解决此问题的任何方法是否需要使用html标记或其他东西?

如果发送没有标题信息的邮件,则将表、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)
你需要设置

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
然后:

mail($email_naar, $email_onderwerp, $email_bericht, $headers);

您需要在邮件呼叫第四个参数中添加标题 专门用于您需要的相关字符集 '内容类型:文本/html;字符集=iso-8859-1'

请参阅以了解有关在电子邮件中发送标题的更多信息。您将需要其中的一些,如“回复”和其他一些

我认为邮件功能将邮件作为纯文本发送,其中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);
?>

谷歌的代码源:php-mail-html.Thx-m8帮了我很多忙,我在谷歌上查错了,我想很抱歉
mail($email_naar, $email_onderwerp, $email_bericht, $headers);
<?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);
?>