Ankit
Ankit

Reputation: 4710

Emailing script - reply to message Gmail conversation

I have setup an email for my domain to forward emails to a my personal email. I'm writing a simple mailing script to reply to some emails i receive as forwarded email using the domain's email id. I'm using Sendgrid to do that. Whenever i send a response back though, it appears as a new conversation in Gmail inbox. I'm not sure what all params I need to set to make the conversation appear as a single bundle.

here's my sendgrid code:

message = sendgrid.Mail()
message.add_to(email)
message.set_from(my_name + " <" + my_email + ">")
message.set_subject(subject)
message.set_html(body.replace('\n', '<br />'))
message.set_text(body)
status, msg = sg.send(message)

I use the subject as: "Re: " + and use body from old conversation as:

On Fri, Aug 28, 2015 at 1:00 PM, senders_name <sender's email> wrote:
> 
> ...

Upvotes: 3

Views: 1060

Answers (1)

Ankit
Ankit

Reputation: 4710

Thanks to @FSQ suggestion.I was able to make the email conversation attach together. I look up the Message Id from: Gmail message > right side dropdown > show original

You should see something like:

In-Reply-To: <14f75e5a9b1.3f4.b2d01d@ismtpd-057>
Message-ID: <14f760957fc.5888.11ab5eb@ismtpd-085>

This is your message id. Send this in the header of email as:

message.set_headers({'In-Reply-To': '<14f760957fc.5888.11ab5eb@ismtpd-085>'})

And it works!

Upvotes: 2

Related Questions