Search code examples
laravelgmailhtml-emailemail-attachments

Laravel embed image into email shows image as actual size in Apple Mail


I'm sending an email from my laravel application via Mailgun. I'm using the embed function so that the image's will showing Gmail as it blocks images but now im running into a problem with Apple Mail, if I set the image width and height it ignores this and shows the image at its true file size. So if I have an image with the width and height of 100px and set the width and height as 50px in my email Apple Mail ignores it but Gmail shows it as 50px as expected. Any work around for Apple Mail? Apple Mail shows it as the correct size when not using the embed feature in Laravel.

<img src="{{ $message->embed(public_path() . '/img/mail/logo.png') }}" width="22" height="22" style="max-width: 22px;-ms-interpolation-mode: bicubic;vertical-align: middle;border: 0;line-height: 100%;height: auto;outline: none;text-decoration: none;" />

Thanks in advance!

-Jamie


Solution

  • Change your code, do not use width and height attribute in tag. Use in style. I hope this will solve your problem.

    <img src="{{ $message->embed(public_path() . '/img/mail/logo.png') }}" style="width:22px; height:22px; max-width: 22px;-ms-interpolation-mode: bicubic;vertical-align: middle;border: 0;line-height: 100%;height: auto;outline: none;text-decoration: none;" />