【发布时间】:2017-03-14 09:31:59
【问题描述】:
我想用 swift 发送一个 HTML。我是否需要创建一个包含<html>和<head>、<body> 标签的html 电子邮件,或者switfmailer 会自动执行此操作吗?
例如,如果我想发送内容为My <em>amazing</em> body 的html 电子邮件,那么使用就足够了
// Or set it after like this
$message->setBody('My <em>amazing</em> body', 'text/html');
或者我需要写吗
// Set the body
$message->setBody(
'<html>' .
' <head></head>' .
' <body>' .
' My <em>amazing</em> body' .
' </body>' .
'</html>',
'text/html' // Mark the content-type as HTML
);
正确的做法是什么?
【问题讨论】:
标签: html swiftmailer