2

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

user147529
  • 555
  • 1
  • 7
  • 18
  • 1
    Try the GmailApp – Cooper Aug 05 '20 at 16:26
  • Can you explain this `I didn't use the gmail version as my google account uses my work email` – Cooper Aug 05 '20 at 16:28
  • When I signed up for a google account, the email address was my work account (we had to have it linked for security or something). So i cant actually use gmail with it. I imagine with Gmail App I need to put my email with a gmail domain. I can try it anyway, haven't actually tried – user147529 Aug 05 '20 at 16:38
  • Sorry I had tried it. I get this error Exception: Gmail operation not allowed. : Mail service not enabled (line 44, file "Code") – user147529 Aug 05 '20 at 16:40
  • @user147529 - well, those who said to you that you only have 2 options here: accept or ditch are either lying or are misinformed. Where your email ends up depends on a whole set of factors (one of which is using `MailApp` instead of `GmailApp`, that I cannot argue against), including email content, presence of tracking code, size of the email, attachments (if any), etc. Also, Outlook has aggressive filters... – Oleg Valter is with Ukraine Aug 05 '20 at 18:23
  • On the note of "next best" alternative (be careful with such questions in the future, btw, they tend to be closed for being either opinion-based or asking to recommend a service) - you can use any of the cloud providers (like Amazon SES) or a dedicated service (costly, but if you need < 100 emails per day, any will do - Sendgrid, Mailgun, etc) – Oleg Valter is with Ukraine Aug 05 '20 at 18:26
  • 1
    yeah thank you for your input. I put my email through a spam tester and it didn't highlight much, except for something that looked too technical for me to change and it scored well. I have gcp so was looking at sendgrid an using cloud functions, it also looked complicated, so wanted to double check for other methods for this. thankfully gmail worked perfectly – user147529 Aug 06 '20 at 09:46
  • 1
    Have you tried using [Gmail API](https://developers.google.com/gmail/api) to see if your emails are still ending up in spam/junk folders? – Mateo Randwolf Aug 06 '20 at 12:58
  • yes gmail app worked fine. i had a comment here saying it worked, but it's disappeared. thanks for your help – user147529 Aug 06 '20 at 13:35
  • @user147529 - yeah, setting up cloud emailing can be complex (fun fact of the day - you can set up interaction by simply calling the corresponding API with `UrlFetchApp`), but hopefully, you will not need to change from the simplicity of `GmailApp` class. – Oleg Valter is with Ukraine Aug 06 '20 at 14:59
  • Re: comment - I flagged it as "no longer needed" before as I thought @Cooper will convert the comment to the answer to guide others ( if it is not converted in a couple of days, I will add a community wiki here ) – Oleg Valter is with Ukraine Aug 06 '20 at 15:00
  • @OlegValter I don't under stand your comment here. Which comment of mine are you refer to. – Cooper Aug 06 '20 at 15:55
  • @Cooper - the first one, the suggestion worked :) As for the comment removed - it was a "thank you, it worked" comment by the OP, sorry for the confusion! – Oleg Valter is with Ukraine Aug 06 '20 at 15:57
  • 1
    @OlegValter I didn't seem to me to be something that deserved being elevated to a full fledged answer. – Cooper Aug 06 '20 at 16:01
  • 1
    Hi @user147529 if Gmail API solved your issue could you please formalise your comment into an answer to your own question so that other users having similar problems can easily find the solution? Many thanks ! :D – Mateo Randwolf Aug 07 '20 at 07:31

1 Answers1

0

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

user147529
  • 555
  • 1
  • 7
  • 18
  • 1
    Mine still does!, Please look at this question of mine: https://stackoverflow.com/questions/68059009/mails-sent-by-gmailapp-are-getting-into-spam-folder – shenkwen Jun 20 '21 at 18:44