google-apps-scriptgoogle-sheetsaliasmacos-mail-app

GoogleScript - Change "From" in MailApp


I do not have access to our corporate No-reply Email address to use GmailApp.sendEmail as an alias, so I'm stuck with MailApp.sendEmail

I already have the reply-to corrected; but I am trying to get the actual FROM on the email to show something other than my email address, any suggestions?

   MailApp.sendEmail(emailAddress, "NO-REPLY@xxxxx.com", subject, message); 

Thank you in advance.


Solution

  • Answer:

    You can specify the option noReply in order to discourage recipients from responding to emails. However, you have to call the function sendEmail in a different way: sendEmail(recipient, subject, body, options) The parameter options is a Javascript option and looks like this:

    options = {
      noReply: true
    }
    

    But keep in mind that if you use noReply you can't specify a replyTo address. If you want to provide one for them to reply I would specify it in the message. Futhermore, for future cases I recommend you to use GmailApp instead of MailApp as it has more features.

    References: