Sending Multiple Emails using Batch Request with Gmail API using Google Apps Script

Gists This is a sample script for sending multiple emails using the batch request with Gmail API using Google Apps Script. When multiple emails are sent using “GmailApp.sendEmail” and “MailApp.sendEmail”, a loop is used. But in this case, the process cost becomes high. In this post, I would like to introduce the sample script for reducing the process cost under this situation. Gmail API can be requested with the batch request.

Sending Gmail with Title and Body Including Emoji using Google Apps Script

Gists This is a sample script for sending Gmail with the title and body including Emoji using Google Apps Script. Sample script This sample script uses Gmail API. So please enable Gmail API at Advanced Google services. Ref const convert_ = ({ to, emailFrom, nameFrom, subject, textBody, htmlBody }) => { const boundary = "boundaryboundary"; const mailData = [ `MIME-Version: 1.0`, `To: ${to}`, nameFrom && emailFrom ? `From: "${nameFrom}" <${emailFrom}>` : "", `Subject: =?

GAS Library - GmailToList

Overview This is a library for exporting all messages of Gmail as a list using Google Apps Script (GAS). Description Recently, I have had a situation it had been required to backup all messages in own Gmail. In order to achieve this, I created a simple script. After I created it, I thought that when such situation might occur for other users and the script is published as a library, they might be useful.

Adding a Label to a Message using Message ID for Gmail

Gists These are sample scripts for adding a label to a message using message ID for Gmail. Sample 1 This sample adds a label to a thread using message ID. In this case, all messages in the thread have the label. Even if it adds a label to a message in the thread using addLabel(), all messages in the thread have the label, becauce addLabel can only be used for the thread.

How to Retrieve Replied Emails for Gmail

Gists Description : This sample script is for retrieving emails which replied for received mails. Because there are no samples which confirm whether the owner (me) replied to the received mails, I created this. The point is as follows. When there are more than 2 messages in a thread, there might be a possibility to have replied. For more than 2 messages in a thread The email address of “from” for the 1st message is the sender’s address.

Send mails from Gmail using Nodemailer

Gists This is a sample script for sending e-mails from gmail using Nodemailer. In order to use this, please retrieve the folloing parameters before run this script. gmail address client ID client Secret Refresh token Please include in the scope. Enable gmail API at API console. Install Nodemailer const nodemailer = require('nodemailer'); var auth = { type: 'oauth2', user: '### your gmail address ###', clientId: '### client ID ###', clientSecret: '### client secret ###', refreshToken: '### refresh token ###', }; var mailOptions = { from: '#####', to: '#####', subject: 'sample subject', text: 'sample text', html: '<b>sample html</b>', }; var transporter = nodemailer.

Decoding Gmail Body with Japanese Language using Python

Gist This is a sample script for decoding Gmail body with Japanese language using Python. msg = service.users().messages().get(userId='me', id=id).execute() parts = msg['payload']['parts'] for e in parts: msg = base64.urlsafe_b64decode(e['body']['data']).decode('utf-8').encode('cp932', "ignore").decode('cp932') print(msg)