Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138221

Replying to Gmail thread sends email to myself

$
0
0

Documentation: https://developers.google.com/apps-script/reference/gmail/gmail-message#replybody-options

When following up an email given there's no response after the initial email, reply() goes to myself, given I'm the one who sent the last email.

So for example, client A sends email to client B. Client A runs script below and reply goes to client A, but it should go to client B as it's only following up since there was no initial reply from B. At least that's how it goes in Gmail interface. I want to send a follow up.

I could run a separate sendmail, but that'll start a new thread unless you can specify the in-reply-to header or the user has responded to the existing thread, which they have not in my case.

Example code:

 message.reply("incapable of HTML", {
   htmlBody: "<b>some HTML body text</b>",
   replyTo: theirEmailAddress,
 });

However, replyTo actually just specifies the reply-to part of the email being sent, so the response that we receive. It has nothing to do with the actual to field aka recipient.

If I do replyAll, then the header for the email is:

from: me@me.com
to: them@them.com
cc: me@me.com

So from that, I get a bunch of emails from myself. I tried specifying cc as none but that didn't change the cc field.

threads[0].replyAll("Just wanted to follow up and see if you got my last email.", {
htmlBody: followUpText,
cc: null,
});

How do I follow up an email, and send it to the original recipient of the last email?


Viewing all articles
Browse latest Browse all 138221

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>