Search code examples
google-apps-scriptoutlookgmailspam

How to stop emails sent via MailApp.sendEmail from going into junk folder in Outlook?


I have set up a script to send emails using Google Apps Script. However, the emails keep going into the junk folder in my outlook account, despite all my efforts to allow the emails (using rules, junk setting, etc).

I asked on a Microsoft forum and they said that google apps script is notorious for sending spam emails so I'll have to accept it will go to the junk folder or use an alternative. so I have two questions:

  • has anyone found a way to stop it going it into junk?
  • is there a next best alternative for sending email alerts based on google sheets values?

This was the function I'm using

MailApp.sendEmail(email, subject, message)

I didn't use the Gmail version as my google account uses my work email


Solution

  • You can use the Gmail API. If your account does not have a gmail associated with it, just go to gmail and create a gmail account with your Google account

    https://developers.google.com/apps-script/reference/gmail/gmail-app#sendemailrecipient,-subject,-body

    When I used this, the messages were no longer going into Junk