MailApp/GmailApp fails to send bcc to address alias

I'm using GmailApp/MailApp to send notification emails, and I want to bcc my self using an "address alias", but no email is delivered to my gmail.

Example:

Email is sent to [email protected] <- Works
BCC is sent to [email protected] <- Does not work

If I remove the "address alias" from my BCC, it works;
BCC is sent to [email protected] <- Works

However this means I can't filter the notifications properly etc.

Sending an email to [email protected] from some other email account works fine as expected.

Code:

function sendEmail(to, subject, body) {
  
  // Default options
  var options = {
    name: 'System notifications',
    bcc: '[email protected]'
  };
  
  MailApp.sendEmail(to, subject, body, options);

}

Rule:

Matches: to:([email protected])
Do this: Apply label "notifications", Never send it to Spam, Mark it as important

Upvotes: 1

Views: 756

Answers (1)

user3075569
user3075569

Reputation:

Your code looks okay, It is probably skipping your inbox, try looking in All Mail or Sent Mail

To prevent clutter, Gmail doesn't route messages that you send to your own alias to your inbox. You can find the message in Sent Mail or All Mail. If you need to see messages sent to your alias in the Inbox, you can configure the alias as an alternate "Send mail as" address for your account. — Source

Upvotes: 2

Related Questions