0
votes

I tried to autosend mass emails from google script editor, using a list of email addresses on google sheet. I followed this tutorial.

I used my other gmail address as a test and succeeded in receiving the email, but I found that some longer sentences are broken into several lines that are not compatible with the browser size. I have tried the GmailApp.sendEmail method instead of the MailApp.sendEmail one, but the sentences are just broken in slight different ways.. However, the email format seems current when I sent it to my sender address..

Does anyone know how to send a complete normal long email? Many thanks!

1
You can save the email body as variable instead of fetching it from sheets cell. For tutorial you shared, it will become var emailTemplate = 'Hi $("First Name")\n\nThanks you!';Urvah Shabbir
Hello @AliceWong, so what exactly is your issue with GmailApp.sendEmail? Because I have used it myself and the format of the mail sent looks appropriate to me.ale13

1 Answers

1
votes

After a few days of trial and error I have actually come to the solution myself.

@urwaCFC - Thank you very much for the suggestion, but unfortunately it does not work - the problem lies in the way gmail deals with plain text, not where the text comes from;

@ale13 - As I mentioned above, text added to gmail using GmailApp.sendEmail, without specifying options, is automatically dealt with as plain text. For some unknown reason, this plain text, if too long, will be broken up randomly into several in lines by gmail when sending the email. The method might work for you because your paragraphs or sentences are not that long.

My solution is to send the email as an html file by adding the following line before sending the mail:

Logger.log(emailText);

And then modifying the GmailApp.sendEmail argument as:

GmailApp.sendEmail(rowData.emailAddress, emailSubject, "", {htmlBody: emailText});

The issue is then solved.