I am working on Google Apps Script. I am trying to send email as follows:
function test_sendmail(){
var subject = "subject";
var body = "https://www.google.com/";
var emailBody = body;
var options = {
htmlBody: body
}
var recipient = "XXXXXXXXX@gmail.com";
MailApp.sendEmail(recipient, subject, emailBody, options);
}
"XXXXXXXXX@gmail.com"(email address A) is not valid, but it's only for showing you an example. I use a real email address in the GAS execution.
The GAS execution is run by another G-suite domain google account(email address B) by which account the code is written.
The email address A has editing rights to the spreadsheet that has the above code in the GAS editor.
But, the email from the above function doesn't get through the email address A. I got this email in the email address B.
LEARN MORE: https://support.google.com/mail/answer/6596?visit_id=637267406328019079-2003975007&rd=1
Then, I replace the email address with the email address B. and I tried to send it, and it did get through successfully.
Secondly, I changed the URL part:
var body = "https://www.google.com/";
to:
var body = "";
Then, the email successfully get through to both email addresses A and B.
The results listed as below:
The failure of sending email with URL to email address like the email address A has occurred recently like from 1 week or 2 weeks ago. Until then, the 4 cases had been successfully done before. I have no idea why this started happening recently.
I checked if the sender email address B is in the contact list of the recipient email address A.
But when I searched it, it appeared, so it seems in all contacts.
Added 1: I tried sending email to the email address C which is another G-suite mail address in the same domain as the email address B, but email address C doesn't have rights to the spreadsheet and the editor.
It sent to the email C successfully even it has no right to the spreadsheet.
Added 2: I tried sending email to the email address D which is other email address that is neither G-suite domain or @google.com address. The result is the same as the email address A.



