Reputation: 65
When using Mailtrap driver in Laravel 5, my HTML email is displayed properly. But when I switched to use MailGun driver email and check it in Gmail, CSS styling is not working properly.
Here is sample original email displayed by GMail:
To: [email protected]
MIME-Version: 1.0
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.=
w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=3D"http://www.=
w3.org/1999/xhtml">
<head>
<meta name=3D"viewport" content=3D"width=
=3Ddevice-width" />
<meta http-equiv=3D"Content-Type" content=3D"text=
/html; charset=3DUTF-8" />
<title>iScholar Registration</title>
=
<style type=3D"text/css">
/* -----------------------------------=
--
I can see that lines are appended by =
symbol.
Here is how I send the email:
Mail::send(
'email.activation',
['activationCode' => $activation->code, 'email' => $email],
function ($message) use ($email) {
$message->from('[email protected]', 'registration');
$message->to($email);
$message->subject('Activate your account');
}
);
What is the recommended way to send HTML email using MailGun REST driver in Laravel 5?
Upvotes: 3
Views: 768
Reputation: 65
This is not related to MailGun at all. For the template to be displayed properly, CSS must be inlined. I used tools described in https://litmus.com/help/email-clients/gmail-no-head/ to solve this.
Upvotes: 3