簡體   English   中英

無法使用laravel + mandrill發送html電子郵件

[英]Can't send html email with laravel + mandrill

我正在使用Laravel 4.2和mandrill插件。 這樣,我可以使用laravel語法(swiftmailer)發送電子郵件,並且郵件是由mandrill發送的。 但是,我似乎無法發送HTML消息。 它們顯示為帶有htmltag的文本電子郵件。 有什么事嗎

    //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']);

    });

blank.blade.php模板中,請確保使用雙花括號,以免逃脫內容

{{ $msg }}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM