Google script mailapp.sendEmail only works with my email address

mailapp.sendemail noreply
mailapp.sendemail from address
google script send email from another address
google sheets - send email button
mailapp.sendemail cc
send html email from google sheets
google apps script email trigger
how to send mass email from google sheets

Okay this is very strange. I have scripting in a spreadsheet to take information from the currently active sheet, creates a report using a template file and sends it as an attachment.

This all works perfectly, when I use my Google apps domain account email address as the recipient. It doesn't work when I send to any other email address, other than my own. It was working yesterday. No errors generated when the script runs

The only thing that I did was change the owner of the spreadsheet to another user in our domain. It was shared with the other user while I was testing the scripts. I've tried using other email addresses in our domain and created a new spreadsheet with the sendemail function, all with the same behavior.

// Email the specified report
function emailReport(file, recipients, emailSubject, emailMessage) {
 MailApp.sendEmail("someone@example.com", emailSubject, emailMessage, 
              {attachments: file, mimetype: 'application/pdf'});
}

I noticed this question a while back, and even referenced it in another one. Since then I've noticed no one responded to you so...

It appears as if Google has recently changed (though not documented anywhere I've found) the MailApp.sendEmail function so that it only works when you use the email address belonging to the owner of the spread sheet.

My guess is this is to prevent the system being used for unsolicited mass emailing.

The other question was here

(Sorry, not an answer as such :( more of a confirmation as to what you are seeing seems to be as expected)

MailApp.Sendemail() not really sending emails , Hi Sorin,. In that scenario the onEdit isn't your choice anymore, it should be time-​based. You can use .getSheetValues and .filter for empty rows. I have exactly the same problem. But I am using a custom email address using G-Suite through Gmail servers. I have even added the correct SPF records to DNS settings as advised by google - it is still not allowing sending email through MailApp.sendEmail in scripts.

I've been able to reproduce the problem and to find a workaround.

As it's not posible to send email to recipients without google account, I add that kind of emails on a cc field.

// Email the specified report as cc
function emailReport(file, recipients, emailSubject, emailMessage) {
 MailApp.sendEmail("my@gmail.com", emailSubject, emailMessage, 
              {attachments: file, mimetype: 'application/pdf', cc:"someone@example.com"});
}

sendEmail(to, replyTo, subject, body) not showing the correct , MailApp.sendEmail({. to: 'replace-this-to-123@gmail.com',. replyTo: See this link: https://developers.google.com/apps-script/reference/gmail/gmail-app# Log the aliases for this Gmail account and send an email as the first one. We'll get back to you only if we require additional details or have more  You can send HTML email from Google Apps Script. For example, suppose you want to send emails from your Google Sheet when certain events occur. You can send email using MailApp.sendEmail() function like this:

For anyone having this issue, use the GmailApp class instead of the MailApp class.

It supports the same functions, for example: GmailApp.sendMail('recipient@gmail.com', 'Subject', 'Message').

https://developers.google.com/apps-script/reference/gmail/gmail-app#sendEmail(String,String,String)

Class MailApp | Apps Script, sendEmail(to, replyTo, subject, body), void, Sends an email message. Integer — the number of emails remaining that the script can send to discourage recipients from responding to emails; this option is only possible for G  Basically, with a Google Apps script, you can send out customized messages to several people with a single click and also customize the content per user if need be. In the next 10 minutes, you will see how your life will become very easy by sending out a large number of emails using Google App script. You can thank me later . Getting Started

Troubleshooting | Apps Script, When your script encounters an error, an error message is displayed in a var rowData = data[rowNumber-1].join(" "; MailApp.sendEmail('john@example.com', a function or class incorrectly, and can only be detected once the script passing the value "john" for the email address when calling MailApp. Feel comfortable using the Script Editor and have experience using the most basic Spreadsheet functions. Section 1: Running a simple example. Create a new empty Spreadsheet; Add a few rows of data. Every row should contain an email address in column A and the email message to be sent to that person in column B.

Change to Mail Service in Apps Script, are two ways to send email in Apps Script: MailApp's sendEmail and only) can use the Admin console to turn on Gmail for their domain. Sends email. This service allows users to send emails with complete control over the content of the email. Unlike GmailApp, MailApp's sole purpose is sending email. MailApp cannot access a user's Gmail inbox. Changes to scripts written using GmailApp are more likely to trigger a re-authorization request from a user than MailApp scripts.

How to Automatically Send Emails from Google Sheets (Using , Sending a Single Email Using App Script in Google Sheets MailApp.sendEmail​(emailAddress, subject, message); sendEmail() function to send an email to the intended email address, with the You will then be given a warning that your App has not been recognized by Google and that you should proceed only if you​  true if the email should be sent from a generic no-reply email address to discourage recipients from responding to emails; this option is only possible for G Suite accounts, not Gmail users: replyTo: String: an email address to use as the default reply-to address (default: the user's email address)

Comments
  • Possible duplicate of MailApp.sendEmail Not Working?
  • Has anyone been able to confirm this...?
  • That's not a solution for the problem.
  • Does not work, 'cc' is treated the same way email is unfortunately.
  • Let me check if something have changed since then. Thanks.
  • This did not solve my problem, which is the exact same as the OP: can only send email to my own email address.