Remove formatting tags from string body of email

前端 未结 5 589
臣服心动
臣服心动 2020-12-03 02:38

How do you remove all formatting tags when calling:

GmailApp.getInboxThreads()[0].getMessages()[0].getBody()

such that the only remainder o

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-03 02:54

    Google now has the getPlainBody() function that will get the plain text from the body of an email. It is in the text class.

    I had been using a script to send emails to convert them to tasks and google broke it with a change to the functionality of Corey's answer above. I've replaced it with the following.

    var taskNote = ((thread.getMessages()[0]).getPlainBody()).substring(0,1000);
    

提交回复
热议问题