我想發送帶有可點擊超鏈接的PHP電子郵件。超鏈接太長以至於大多數程序無法從純文本中檢測到URL,因此我想使用HTML-Email。我使用SwiftMailer,我知道我應該先設置一個純文本電子郵件,然後我可以添加一個html電子郵件。HTML電子郵件中頭,標題,正文標籤的用途
在http://php.net/manual/en/function.mail.php我發現瞭如何編寫一個HTML電子郵件中的例子:
// 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>
';
是重要的設置
<html>, <head> and <body>?
哪裏
<title>
出現?標題應該與主題相同嗎?或者我能不能設置消息像:
// message
$message = '
<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>
';
電子郵件可能採取網頁式的格式有很多原因。 – texelate