我使用的是Laravel 4.2和mandrill插件。这样我就可以使用laravel语法(swiftmailer)发送电子邮件,邮件由mandrill发送。但是,我似乎无法发送HTML消息。它们显示为带有htmltags的文本电子邮件。可能有什么不对?
//Send email
$emailName = $_POST['emailName'];
$emailAddress = $_POST['emailAddress'];
$emailSubject = $_POST['emailSubject'];
$emailMessage = html_entity_decode($_POST['emailMessage']);
$emailFrom = $_POST['emailFrom'];
$emailFromName = $_POST['emailFromName'];
$pathToAttachement = $_POST['pathToAttachement'];
$data = array('emailAddress' => $emailAddress, 'emailName' => $emailName, 'emailSubject' => $emailSubject, 'emailFrom' => $emailFrom, 'emailFromName' => $emailFromName, 'pathToAttachement' => $pathToAttachement);
Mail::send('admin.emails.blank', array('msg' => $emailMessage), function($message) use ($data)
{
$message->setContentType('text/html');
$message->from($data['emailFrom'], $data['emailFromName']);
$message->to($data['emailAddress'], $data['emailName'])->subject($data['emailSubject']);
$message->attach($data['pathToAttachement']);
});
答案 0 :(得分:1)
在enum Food: Int {
case None, Pizza, Pancakes
init(string: String) {
switch string {
case "Pizza":
self = .Pizza
default:
self = .None
}
}
}
let foo = Food(string: "") // .None
let bar = Food(string: "Pizza") // .Pizza
模板中,请确保使用双花括号,这样您就不会逃避内容
blank.blade.php