Nástroje používateľa

Nástoje správy stránok


Bočný panel

Sidebar


Články

Prečítané diela

Hlášky

Projekty

Tagy

Twitter


blog:odborny:2019-11-05-forcing_gmail_to_send_email_with_zero_margins

Forcing Gmail to send email with zero margins

By default, it is not possible to send email with content as backgrounds or images taking up the whole width of email space. However, it is possible to do so with the following little trick.

This comes in handy when you want to resend e.g. nicelyformatted Mailchimp email and still retain its fullwidth layout (recall those wonderful header and footer images with no right and left margins!).

Solution

The procedure consist in directly altering email HTML code before sending it. To do so, you need some browser extension that will allow you to do this. The addon I used was cloudHQ's Free HTML Editor for Gmail. So:

  1. Install Free HTML Editor for Gmail Chrome extension
  2. Open the email draft you want to edit.
  3. Click Edit as HTML icon added by the extension
  4. On the top of the email, write:
    <style>
      body, #bodyTable, #bodyCell {
        height:100%;
        margin:0;
        padding:0;
        width:100%;
      }
      :root {
        color-scheme: light only;
      }
    </style>
    <meta name="viewport" content="width=device-width, initial-scale=1" class="">
    <meta name="color-scheme" content="light only">
    1. The <style>tag first part will remove the borders for desktop clients.
    2. The viewport meta tag will achieve the same on mobile devices. You may eventually remove the #bodyTable and #bodyCell selectors if they are not present in email source code (Mailchimp usually uses them in its emails).
    3. The last part with colorscheme is there to prevent the email from getting different colors in iOS/macOS Dark mode (for more info, see this thread on StackOverflow and also this article.)
  5. Click Save and Close and you are done!

Tip

To send the same email you received (for example, the test Mailchimp mail you have sent to yourself), you can move it from Inbox to Drafts in native macOS Mail application by simply dragging it from one folder to another (or hold Alt key while dragging to copy it).

Comments

blog/odborny/2019-11-05-forcing_gmail_to_send_email_with_zero_margins.txt · Posledná úprava: 2020/01/06 22:08 od Róbert Toth