简体   繁体   English

Google App Script - 从谷歌表发送长电子邮件 - 电子邮件被分成几行

[英]Google App Script - Send long email from google sheet - email broken into lines

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.我用我的另一个gmail地址作为测试,成功收到邮件,但发现有些较长的句子被分成几行,与浏览器大小不兼容。 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..我已经尝试了 GmailApp.sendEmail 方法而不是 MailApp.sendEmail 方法,但是句子只是以略有不同的方式被打破了..但是,当我将它发送到我的发件人地址时,电子邮件格式似乎是最新的..

Does anyone know how to send a complete normal long email?有谁知道如何发送完整的普通长电子邮件? Many thanks!非常感谢!

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; @urwaCFC - 非常感谢您的建议,但不幸的是它不起作用 - 问题在于 gmail 处理纯文本的方式,而不是文本的来源;

@ale13 - As I mentioned above, text added to gmail using GmailApp.sendEmail, without specifying options, is automatically dealt with as plain text. @ale13 - 正如我上面提到的,使用 GmailApp.sendEmail 添加到 gmail 的文本,没有指定选项,会自动作为纯文本处理。 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.由于某种未知的原因,这个纯文本,如果太长,在发送电子邮件时会被gmail随机分成几行。 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:我的解决方案是通过在发送邮件之前添加以下行将电子邮件作为 html 文件发送:

Logger.log(emailText);

And then modifying the GmailApp.sendEmail argument as:然后将 GmailApp.sendEmail 参数修改为:

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

The issue is then solved.那么问题就解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM