Reputation: 526
I am trying to make an application that will send me an email automatically every time there is a change done to the sheet. I know there are notifications that are able to do this but three things.
I already know that the onEdit()
function doesnt really like when you send emails out, but Im trying to work around that to maybe compile a list of changes and send that list alone at a certain time, and then clear the list.
But I havnt even gotten there yet, because the MailApp.sendEmail
is not working the way I need it to, I tried pretty much everything.
I set up a test case for me to send to an automated email to my work Gmail as follows.
function emailTest(){
MailApp.sendEmail("[email protected]", "This is the subject", "This is the message");
}
This works great, however I need to send the email to my company domain email, which is using outlook, so I went ahead and made the following changes.
function emailTest(){
MailApp.sendEmail("[email protected]", "This is the subject", "This is the message");
}
And then nothing happens, simply nothing. So I change it my personal gmail, to see if anything gives.
function emailTest(){
MailApp.sendEmail("[email protected]", "This is the subject", "This is the message");
}
And it works! no issues nothing, so then I change it to my personal non-gmail email.
function emailTest(){
MailApp.sendEmail("[email protected]", "This is the subject", "This is the message");
}
And it still works.
My head is trying to wrap around whats going on. I try to send a manual email from my work Gmail account to my outlook Gmail account and it works as well. I then say ok, let me just send the automated emails to my work Gmail and forward those emails to my outlook email. And that doesnt work. I then tried to send an email from my personal Gmail to my work Gmail and see if that gets forwarded, and it does. So I think and Im thinking maybe for some reason I cant forward emails that I send myself (the automation emails come in as you as the sender), so I make ANOTHER gmail account and I send the automation emails to the new Gmail and get that forwarded to my work outlook account. This however failed to work as well.
So I get on the phone with our tech support team and see if there is anything blocking outlook from receiving these messages, it seems like there isn't, but they really didn't know where to look.
Can anyone help me figure out whats going on?
Does Gmail have some sort of block to not send to business emails?
Does outlook have some of block not to accept certain emails that are flagged as automated?
A few notes:
GmailApp.sendEmail("[email protected]", 'From an alias', 'A message from an alias!', {'from': Session.getActiveUser().getEmail()});
Update I just received this email from Google. I didnt try to send an email for a good few hours. It seems like the email that was kicked back was sent yesterday, as its a reply to that email.
Upvotes: 3
Views: 476
Reputation: 526
The issue was with the name of my email. I named my business gmail [email protected] and we have a rule in a spam organizer that blocks all emails with the company name in them that comes from the outside. So it was a quick fix to whitelist my email and it was all good to go.
Upvotes: 1