How to Send Emails from a Different Address (Alias) with Gmail

Say you have two email accounts - personal@gmail.com and work@company.com - the former is your personal email address while the latter is your work (corporate) email address. You are logged into your personal Gmail account but would like the mail merge to go out from your work account.

Consider another scenario where the personal secretary needs to sends out emails on behalf of her boss. So she runs the merge while staying logged into her own Google account but the recipients will see her boss’s email as the sender.

Both these scenarios can be easily handled in Mail Merge and Document Studio by setting up aliases in Gmail.

You can even send emails from your Outlook, Yahoo or Zoho email addresses through aliases in Gmail. Students and teach can send emails from their @school.edu email address while logged into their personal email accounts.

How to Setup Email Aliases in Gmail

Open gmail.com on your desktop computer, go to Settings, click the Accounts tab and, under the “Send mail as” section, click the link that says “Add another email address.”

Gmail Add Email Address

Next, follow the wizard to add the other email address as an alias to your current email address. You need to specify the sender’s name, the email address on behalf of which you wish to send out th emails and the reply-to address (optional).

Gmail Alias Setting

Treat as an alias - Yes or No?

If you own both email accounts, check the “treat as alias” option and emails sent to either address will arrive in the same Gmail inbox.

If you are sending emails on behalf on another person, say a secretary sending emails on behalf of his or her boss, the option should be unchecked. When the recipient replies to messages you send from the alias, the To: field in their reply message will be filled with your alias email address.

Gmail Verification

Gmail will send a verification code to your other email address that you wish to add as an alias to verify whether you really own or have access to that email account.

Verification Email Link

Log in to your other Gmail account and open confirmation email. Copy the confirmation code and paste it into alias verification box. Your other email address will now be added as an alias to your primary email address.

Change the Email Sender

This is how you can send emails from a different address in Google Sheets.

Mail Merge for Gmail

Send Email from Alias

Open your Google Sheet, choose Addons > Mail Merge with Attachments > Configure to open the merge sidebar. Expand the “Sender’s Email” dropdown and it will have a list of all email aliases that are connected to your Gmail account.

You can now send personalized emails on behalf of any email address that you own or have verified as an alias.

Document Studio

Open Google Sheet, go to Add-ons > Document Studio > Open. Expand the Mail Merge section and click on edit to open the Email Template designer. You’ll have an option to change the email sender as shown in the screenshot below:

Change Email Sender

Error - Cannot Add Aliases in Gmail

Are you getting an error while adding an alias in Gmail?

You must send through gmail.com SMTP servers you can send as abc@work.com. However, this functionality is not available for your account. Please contact your domain administrator.

If you do not see an option to add aliases in your Gmail settings, it is likely because your Google Workspace (GSuite) domain administrator has disabled the option to send email from aliases in domain settings.

To enable email sender aliases in Google Works, ask the admin to:

  1. Sign into the Google Admin console admin.google.com.
  2. From the dashboard, go to Apps > GSuite > Gmail > End User Access.
  3. Turn on the “Allow per-user outbound gateways” setting that says “Allow users to send mail through an external SMTP server when configuring a “from” address hosted outside your email domains.”

Save the settings and wait for about 30-60 minutes for the changes to propagate. You’ll then be able to added external email addresses as aliases in your Google Workspace email account.

Google Workspace Email Setting Send from a different email address in Google Workspace

How to Embed Barcode and QR Code In Google Forms Notifications

The Google Form Notifications add-on lets you automatically send Google Form responses in an email message to one or more recipients. The email notifications are dispatched the moment your form receives a new submission.

The more recent version of the Google Form addon includes support for QR Code and Barcode symbols that you can embed in the email messages. The images can be generated from static text or you can create dynamic images based on answers submitted by the user.

Add QR Code images in Emails

The basic syntax for adding QR Code images in emails is:

=QRCODE(Your Text Goes Here)

You can customize the colors and size of the QR code image by adding key-value pairs in the QRCODE function.

For instance, if you would like the QRCode to have Indigo background and the QRCode should be itself in white color, the modified formula with the hex color codes would be:

=QRCODE(TEXT textcolor=#FFFFFF backgroundcolor=#4B0082)

The QR Code images have a default width of 300px but if you customize the size with the width parameter as shown below:

=QRCODE(TEXT width=225)

Insert QR Code in Google Form

Include dynamic text in QR Code images

Until now, we have seen examples of static text but the Google Forms addon can also create QR Code images from text in Google Form Answers using placeholders.

For instance, if your Google has a question title “What is your website address?”, you can use a QR Code function like the one below. This will turn the user’s answer into a dynamic QR code that, on scanning, will take you to the form respondent’s website.

=QRCODE({{WWhat is your website address}} textcolor=#4B0082)

Embed Barcode in Email Notifications

The Email Notifications add-on also includes support for BARCODE function to help you embed barcode images in PNG format for EAN, UPC, ISBN, postal codes, GS1 Database and all other popular formats.

The basic syntax for barcode function is:

=BARCODE(TEXT format=CODE39)

For instance, if you would like to embed the barcode image for a book whose ISBN-13 code is 9781786330895, the function would be:

=BARCODE(9781786330895 format=EAN13 includetext=true)

The includetext=true parameter would ensure that the text for data is included into the barcode image.

Insert Barcode symbol in Google Form

You can also modify the colors of barcode image using hex codes:

=BARCODE(9781786330895 format=EAN13 includetext=true barcolor=AA0000 textcolor=008888 backgroundcolor=FFFF60)

You can similarly modify the width of the Barcode image, the height of the bars, add borders, padding and more. Please consult the documentation for a complete range of formats and options supported by the =BARCODE() function in Google Forms.

How to Password Protect Google Documents and PDF files in Google Drive

Introducing PDF toolbox, a new Google Drive addon that lets you password protect PDF files and Google Documents. The app can also help you unlock PDF files that are already protected with a password in your Google Drive.

Watch the video tutorial to get started.

Password Protect PDF Files

To get started, install the PDF toolbox add-on and grant the necessary authorization. The app requires access to the file that you would like to encrypt (or decrypt) and you also have an an option to send the encrypted file as an email attachment to another user.

Next, select any PDF file or Google document in your Google Drive and expand the “Encrypt PDF” section. Enter the output file name (it will also be saved in your Google Drive), provide a password and specify whether the encrypted file should allow printing and comments.

Click the Encrypt button to create a new PDF file that would require a password to open.

Password protect PDF files

The app can secure PDF files as well as Google documents, spreadsheet and presentations. In the case of native Google documents, the file is first converted to a PDF document and then encrypted with the specified password.

Please note that the Google Drive API imposes a limit of 10 MB on the size of PDF files exported from native Google documents. Thus, similar restrictions apply with the toolbox as well.

Unlock PDF files

If you a password-protect PDF file in your Google Drive, you can use the PDF toolbox to remove the password protection. The app will create a new copy of the PDF file in your Drive that will open without requiring a password.

The workflow is similar.

Select any locked PDF in Google Drive and open the PDF toolbox app in the sidebar. Expand the “Decrypt PDF” section and and type the password that was originally used to restrict access to the PDF file.

Click the Decrypt button and, if the password matches, all restrictions would be removed from the file. The unlocked, password-free PDF file would be uploaded to Google Drive as a separate file.

Remove PDF Password

How PDF toolbox works

All files in Google Drive have an export link to download the file in PDF format. The app uses the export URL to fetch the PDF version of a file in Google Cloud storage, encrypts (or decrypts) the file with the PDF library and uploads the processed file to Google Drive of the authorized user.

All downloaded files are instantly removed from the cloud storage after the PDF file has been exported. PDF toolbox is in beta stage and the pricing will be added later this month.

Also see: Remove PDF Passwords with Chrome

How to Request Additional Quota for your YouTube API Project

A UK based organization recently organized an online conference with 300+ participants and each of the attendees were asked to upload a video to a common YouTube channel post the event. The organizers created a YouTube uploader to make it easy for attendees to submit videos but soon ran into the quota issue with YouTube.

Let me explain.

The YouTube API website says that 1600 quota units are required to upload a single video to the YouTube website through the videos.insert method of the YouTube API. Thus, for instance, if you are expecting users to upload 100 videos to your YouTube channel in a single day, your Google Cloud project should have a quota of at least 1600 * 100 = 160,000 units.

The quota limits reset every 24 hours. New Google Cloud projects have lower quota and you’ll have to request YouTube to increase your quota if you are expecting higher number of videos.

Increase your YouTube API Quota

Here’s step by step guide that will help you get your YouTube video uploader, or any other Google Apps Project, approved for higher quota.

Configure Google Cloud Project

1. Go to console.cloud.google.com/projectcreate to create a new Google Cloud Project.

Create Google Cloud Project

2. From the menu, go to APIs and Services and chose OAuth Consent Screen. Set the type as External and click the Create button.

Oauth Consent Screen

3. Give your application a name, then click the Add Scope button and specify the list of OAuth Scopes that your Google Cloud project will require. For the uploader, we require the following Google APIs:

https://www.googleapis.com/auth/youtube.readonly
https://www.googleapis.com/auth/youtube.upload
https://www.googleapis.com/auth/script.external_request
https://www.googleapis.com/auth/script.send_mail
https://www.googleapis.com/auth/userinfo.email

OAuth Consent screen

4. Inside the API and Services section, choose Library, search for the YouTube Data API library and click Enable to enable the library for your project.

Enable YouTube API

5. Click the 3-dot menu in the upper right, choose Project Settings and make a note of the project number of your Google Cloud Project.

Google Cloud Project

Configure Google Apps Script

1. Open your Google Script, go to the Resources menu, choose Cloud Platform project and enter the project number that you have copied in the previous step.

Link Cloud Project with Apps Script

Click the “Set Project” button to link your Google Cloud Project to your Google Apps Script Project.

2. Go back to the Google Cloud project, click the API and Services section, choose Credentials and copy the OAuth client ID to the clipboard.

OAuth Client ID

Request YouTube to Increase Quota

Now that you have all the necessary data, it is time to submit your YouTube project to Google for increasing your API quota. Open this request form and fill the required details.

The API client is the same as the OAuth Client ID that you copied in the previous step. The project number is the same as your Google Cloud Project number. For the “Where can we find the API client” question, you need to provide the link of your YouTube uploader form.

Submit the form and you’ll receive a response from Google Compliance team saying they are conducting an audit.

Thanks for your response to the Quota Request. We will conduct our audit based
on the information you provided. We will notify you if additional information is
needed or when we’ve completed our review. Thank you for your cooperation.

They may have some follow-up questions and once they grant the quota (usual takes 3-4 days), you’ll receive a confirmation.

Your quota extension request has been approved based on the information you
provided and your representation that your use of YouTube API Service are in
full compliance with the YouTube API Services Terms of Service. The total quota
for project 123 is now 500,000 units / day. Please note that the quota extension
has been granted ONLY for the use-case mentioned in your quota extension request
application and we may change your quota based on your actual quota usage as
well as on your continued compliance with the YouTube API Services Terms of
Service at any time.

Reclaim Disk Space – How to Find the Biggest Files in your Google Drive

Your Google account storage is shared between Gmail, Google Drive, and Google Photos. What do you do when your Google account is running out of storage space? You either buy more storage from Google or the inexpensive option is that you spend some time spring-cleaning your account and delete the emails and files that could be hogging up the storage space.

Recover Spaces in Google Drive

First things first. Go to google.com/settings/storage and click on the “View Details” link to know the total available disk space and see exactly how much storage space is used by the email and drive service.

Gmail offers the size search operator so you can easily find emails that have large attachments and delete them to reclaim space. For instance, a query like size:5MB older_than:1y will show all emails older than a year and that take up more than 5 MB of space in your Google account. See more Gmail search operators

Unlike Gmail, there’s no easy way to find large files by size in Google Drive but there’re some easy workarounds to find the big files in your Google account.

For Gmail accounts

If you have a @gmail Google account, go to one.google.com and click the “review” link under Large Files.

Google Drive Large Files

You’ll get a sorted list view of all files in your Google Drive, sort by size. Select the ones you no longer need and hit the delete button to instantly recover space.

Please note that files deleted from the Storage manage inside Google One are permanently deleted and can no longer be recovered.

For GSuite (Google Workspace) accounts

GSuite is now Google Workspace and, apart from rebranding, Google no longer offers unlimited Drive storage that was earlier available with the GSuite Business plan. The Enterprise plans do not impose any storage limits.

To reclaim space in Google Drive for GSuite accounts, open this link drive.google.com/drive/quota and you’ll get a list of all files in your Google Drive arranged from largest to smallest size

You can remove the files that you no longer need but there’s one extra step. Google Drive will move the files to the trash bin so you’ll have to empty the bin as well to reclaim space.

The Google Drive files list only includes non-native file formats since the native Google files - like Google Documents or Google Sheets - do not take any storage space on your Google Drive.

Tip: Use the Drive Auditor to get a detailed report of all Google Drive files that can be sorted by size in Google Sheets.

Delete App Backups

In addition to binary files, certain apps may be using your Drive Storage for storing files and app settings. You cannot explore the individual files that are stored by apps in your Google Drive but you do have an option to delete the data stored by them in your Drive.

Inside Google Drive, go to settings, and choose Manage Apps. Click the options button against the app name and choose “Delete hidden data”.

Google Drive - Hidden App Data

You may also want to check the Backups section in your Google Drive (google.com/drive/backups) that stores backup of your Android phone, app settings and WhatsApp messages. They take up space as well but Google Drive doesn’t specify the exact size of backups.

Also see: Save Gmail to Google Drive

How to Make your Documents Read-only in Google Drive

The files in your Google Drive are private by default and only the owner has initial permissions to view, edit or delete their files. If you choose to share a file with other people, you can decide whether others have read-only access to your files or if they are allowed to edit and comment on your files.

You can always remove external collaborators from your documents to prevent them from editing your files but how do you prevent yourself (the owner) from accidentally editing your own files in Google Drive?

Locked Google Drive File

How to Prevent Document Edits in Google Drive

Google Drive now has a new Locking API to help developers easily add content restrictions on documents, spreadsheets, presentations, PDF and any other file in Google Drive.

When you lock a file, no one (including the owner) can make edits to the file, the file title cannot be changed and also lose the option of commenting inside files.

Google Drive doesn’t have a simple button (yet) for locking files so here’s a little Google Script that can help you make any file in your Google Drive read-only.

1. Open Google Drive and right-click any file that you wish to make a read-only file. Click the Share Link menu and copy the file link to the clipboard.

https://docs.google.com/spreadsheets/d/12345_abcdef-123/edit?usp=sharing

2. Type script.new in the browser to open a new Google Apps Script project and copy-paste this snippet in the code editor.

/**
 *  Make Google Drive files Read only
 *  Author: amit@labnol.org
 *  Web: https://digitalinspiration.com/
 *  MIT License
 **/
const makeFileReadyOnly = () => {
  const fileUrl = '<<FILE URL>>';
  const [fileId] = fileUrl.split('/').filter((e) => /[_-\w]{25,}/.test(e));
  UrlFetchApp.fetch(`https://www.googleapis.com/drive/v3/files/${fileId}`, {
    method: 'PATCH',
    contentType: 'application/json',
    headers: {
      Authorization: `Bearer ${ScriptApp.getOAuthToken()}`,
    },
    payload: JSON.stringify({
      contentRestrictions: [
        {
          readOnly: true,
          reason: 'Prevent accidental editing',
        },
      ],
    }),
  });
  // For requesting correct scope, do not delete
  // var file = DriveApp.getFileById().setName()
};

3. Replace the FILE URL in line #2 with the URL of the Drive file that you copied in the previous step.

4. Go to the Run menu, choose Run function > makeFileReadyOnly. Accept the permissions and your file will restricted from editing by anyone including yourself.

If you would like to remove the file lock and allow editing, open Google Drive, right click the same file and choose “Unlock file” from the menu to restore the editing behavior.

Also see: URL Tricks for Google Drive

Unlock Google Drive File

Please do note that when you freeze a document with the Google Drive Lock API, even Google Scripts and Google Workspace add-ons are blocked from editing the file.

How to Search Google Images by the Exact Size

Google Images earlier offered a useful “search by size” option in advanced search to help you find logos, wallpapers and other images on the Internet by their exact size (or resolution).

For instance, you could limit your search for landscape photographs to image files that were at least 10 Megapixels in size. Or, if you are were using Google Image search to find wallpapers for the desktop, you could specify the image resolution as 1920x1080 pixels and Google would only return large images with those exact dimensions.

Google Image Search by Size

The “exact size” search option is no longer available in Google Image Search but you can still limit your image searches to a particular size by using the secret imagesize search operator in the query itself.

Here’s how.

Go to images.google.com and enter the search terms as before. Then append imagesize:WIDTHxHEIGHT to your query and hit Enter. Google Images will remove the operator from the query but the results will only display images that match the specified size.

The search by size operators works on the mobile version of Google as well so you may use the simple trick to find that perfect size wallpaper for your phone.

More Search Tricks

You an also use search operators in Gmail, Google Drive, YouTube and Twitter to easily find stuff you’re looking for.

Google Apps Script for Developers

Google Apps Script makes it is easy for you to integrate data and functionality from Gmail, Google Drive, Google Maps, YouTube, and most other Google APIs. Apps Script is JavaScript under the hood so you don’t have to learn a new language and you don’t have to manage any servers since all your code runs on the Google Cloud, not your browser.

In this video tutorial, you’ll learn how to develop Google Apps Script projects locally on your computer inside Visual Studio Code. You can write your code in modern JavaScript, neatly organized in modules, and the build environment will use Babel and Webpack to transform your code into a version of JavaScript that is compatible with Apps Script.

Modern Development with Google Apps Script

There are quite a few advantages with having a local development environment vis-a-vis writing code in the Apps Script Cloud IDE.

  1. You can write code with ES6 Classes, Arrow Functions, Modules, Destructing and use all the other modern JavaScript features.
  2. The development experience inside VS Code is unmatched and tools like ESLint and Prettier make it easier for you to catch errors early in the development.
  3. The build and deployment process can be completely automated with npm scripts and CLASP, Google’s command line utility for Apps Script.
  4. VS Code has built-in support for Git and integrates with source control providers like Github and Gitlab. It is therefore easier to track changes and restore previous versions of the code.
  5. You can quickly integrate JavaScript libraries like LoDash, Moment, Underscore and any of the NPM packages into your code.
  6. You can use modern frameworks like React, Vue.js and Angular to build the HTML frontend that connects to the backend with the Google Script Client API.

Getting Started with the Apps Script Starter

The Starter kit is a boilerplate for quickly getting started with local Apps Script development locally inside VS Code. Open your terminal and run the following commands:

1. Clone the Github repository to a local folder

git clone https://github.com/labnol/apps-script-starter my-project

2. Switch to the project folder

cd my-project

3. Install all the project dependencies and utilities

npm install

4. Connect CLASP to your Google account

npx clasp login

5. Create a new Google Apps Script project in your Google Drive with CLASP

npx clasp create --title "My Project" --rootDir ./dist --type standalone

This command will create a new .clasp.json file in your project folder that links the local folder with your Apps Script project. During build, Webpack will bundle all your code in a single JavaScript file and add it to the ./dist folder that Clasp will push to your Apps Script project.

Next, open the current project folder inside VS Code with the code . command. It includes some sample code but we will start with a blank folder so delete everything that’s inside the src folder.

Inside the src folder, create a new file - email.js - and write a simple arrow function that prints a list of all the email addresses connected to your Gmail account.

apps-script-starter (1).png

Next, create an index.js file (entry point) in the src folder, import the email function that you’ve created inside the email.js file and add it to the global object. This is a requirement of the Webpack plugin for Google Apps Script.

You can also add a function expression to the global object directly, like doGet in the example below.

htmlservice-doget.png

Now that your JavaScript code is ready, open the appsscript.json file in your project folder and modify the oAuthScopes property to only include the scopes that are required by your project.

Next, jump to the command line terminal and run the deploy command to push your code to the Apps Script project.

npm run deploy

If you are deploying the project for the first time, you’ll get a prompt saying “Manifest file has been updated. Do you want to push and overwrite? (y/N)” - say yes.

After the deployment is complete, open the associated script in the browser with the CLASP open command.

npx clasp open

Inside the Apps Script Editor, go to the Run menu and choose the getEmailAddress function from the list. Open the logs and you should see your email addresses in the window.

Then go to the Publish menu, choose Deploy as web app and open the URL in a new browser tab to check the program output. That’s how easy it is to build projects with the Google Apps Script starter kit.

Using Git with Google Apps Script

Create a new repository in Github and make a note of the URL of the new repository. Next, open the terminal and run the following commands to push your Apps Script project to Github.

github-apps-script.png

Also see: Most Useful Google Apps Scripts

The same approach is used by Digital Inspiration for building popular Google add-ons including Gmail Mail MergeGoogle Forms Notifications and Document Studio.

How to Preserve Formatting of Spreadsheet Cells in Mail Merge

The Mail Merge app merges data from a Google Spreadsheet and sends them as personalized emails. You can format your sheet data in multiple colors, choose different font families, vary the size of your text, include hyperlinks, line breaks and more.

The rich text of spreadsheet cells is internally translated into HTML tags with inline CSS and thus the cell formatting is preserved in the outgoing Gmail messages. Here’s an example:

Rich Text Email in Gmail

If you would like to enable this feature, go to the Add-ons menu in Google Sheets > Mail Merge with Attachments > Configure Mail Merge and check the “Preserve Cell Formatting” option.

You can even format your spreadsheet cells with conditional formatting and the text styles will be retained in mail merge. For instance, you can dynamically color the invoice amount column in red and make it bold if the due date has passed and this value would show up in bold red in the email message as well.

Send Rich Text HTML Emails with Google Sheet

This snippet handles the transformation of rich-text Spreadsheet data to HTML. The functions reads the data from a cell, specified in A1 notation, breaks the rich text into blocks that have the same text styles and translate individual blocks into HTML tags.

const sendRichEmail = () => {
  const cellAddress = 'A1';
  const sheetName = 'Mail Merge';
  const recipient = 'amit@labnol.org';

  const richTextValue = SpreadsheetApp.getActiveSpreadsheet()
    .getSheetByName(sheetName)
    .getRange(cellAddress)
    .getRichTextValue();

  /* Run is a stylized text string used to represent cell text.
     This function transforms the run into HTML with CSS
   */
  const getRunAsHtml = (richTextRun) => {
    const richText = richTextRun.getText();

    // Returns the rendered style of text in a cell.
    const style = richTextRun.getTextStyle();

    // Returns the link URL, or null if there is no link
    // or if there are multiple different links.
    const url = richTextRun.getLinkUrl();

    const styles = {
      color: style.getForegroundColor(),
      'font-family': style.getFontFamily(),
      'font-size': `${style.getFontSize()}pt`,
      'font-weight': style.isBold() ? 'bold' : '',
      'font-style': style.isItalic() ? 'italic' : '',
      'text-decoration': style.isUnderline() ? 'underline' : '',
    };

    // Gets whether or not the cell has strike-through.
    if (style.isStrikethrough()) {
      styles['text-decoration'] = `${styles['text-decoration']} line-through`;
    }

    const css = Object.keys(styles)
      .filter((attr) => styles[attr])
      .map((attr) => [attr, styles[attr]].join(':'))
      .join(';');

    const styledText = `<span style='${css}'>${richText}</span>`;
    return url ? `<a href='${url}'>${styledText}</a>` : styledText;
  };

  /* Returns the Rich Text string split into an array of runs,
  wherein each run is the longest possible
  substring having a consistent text style. */
  const runs = richTextValue.getRuns();

  const htmlBody = runs.map((run) => getRunAsHtml(run)).join('');

  MailApp.sendEmail(recipient, 'Rich HTML Email', '', { htmlBody });
};

Known Limitations

You can format the cells of your Google Spreadsheet in any font family - from the cursive Caveat to the heavy Impact typeface - but if the recipient doesn’t have these fonts installed on their computer, the rendered text in the email would fallback to the default font.

The font colors, font size and text styles (bold, italics, underline) get perfectly transformed into HTML but other properties like background fill colors, borders and text-alignment of the cell are ignored.

Also, if your spreadsheet cells are formatted as dates, the rich text functions may not work.

How to Send HTML Emails with Gmail

This tutorial describes how you can easily send HTML emails in Gmail without using any extensions. You can format your Gmail messages to include tables, buttons, custom fonts, social media icons, wrap images around text, and more. A little knowledge of HTML and CSS will come handy but it is not a pre-requisite.

The built-in WYSIWYG editor of Gmail offers basic formatting options - you can make text bold, create lists, change font colors - but that’s pretty much it. There’s no option to insert custom HTML into the message body that is required to send rich emails though Gmail.

Write HTML Emails Directly in Gmail

Let’s start with some basic examples and then we move on to more advanced example where you’ll learn how to send email newsletters that were created separately inside MailChimp.

Insert Buttons in Gmail

This HTML snippet creates a beautiful call-to-action button with a blue background, slightly rounded edges and rendered in the popular Roboto font.

<a
  href="https://digitalinspiration.com/"
  style="background-color:#1a73e8; padding:10px 20px;
         color: white; text-decoration:none; font-size:15px;
         font-family:Roboto,sans-serif; border-radius:5px;
         display:block; margin:20px 0; width: 120px"
  >Explore our work
</a>

We cannot copy-paste this HTML directly into the email editor of Gmail but with the magic of Chrome Dev Tools, we can. Let’s see how:

Open gmail.com and compose a new email message. Add an emoji in the message body to be replaced with the HTML button. Right-click the emoji in the Gmail editor and choose Inspect.

This opens the Developer tools in the bottom half of the browser. Select the <img> tag that contains the emoji, right-click and choose Editor HTML. Replace the selected content with the button HTML and click anywhere outside the dev tools window.

You’ll now see a beautiful HTML button rendered in your email message with all the CSS styles and formatting. Watch the video for a more detailed tutorial.

Insert HTML in Gmail

Insert HTML Tables in Gmail

In the next example, we will embed an HTML table in the Gmail editor. Unlike our button above that had all styles inlined, the CSS of the table is contained in a separate stylesheet.

Therefore, prior to pasting the pasting the table HTML into Gmail, we need to “inline” the styles else the formatting will be ignored by Gmail. This can be easily done through Juice - simply paste the HTML and CSS in the input box and it will inline all the CSS styles in the HTML tags that is compatible with Gmail.

Gmail with Inline CSS

Send Email Newsletters with Gmail

Until now we have seen examples of adding basic HTML blocks inside Gmail but wouldn’t it be nice if we could send professional and responsive email newsletters through Gmail?

Design Email Newsletter for Gmail

If you are new, the term responsive essentially means that the styles change automatically based on the device of the user. So if someone is viewing the email on a mobile phone, they would see a different layout than a person who has opened your email on a desktop computer.

You can use MailChimp or any other email template designer to create the newsletter. The only requirement is that the tool should have an option to download the designs as an HTML file.

You can feed this HTML file into Juice to inline the CSS styles and then insert the transformed HTML into Gmail using the emoji trick. The draft email newsletter can also be used as a template for sending personalized emails with Mail Merge.