How to send a follow-up email that is grouped like a conversation ? #264
-
Hi, I would like to achieve the same effect as when I reply an email using gmail or any other provider, the email is grouped into a conversation. Is it possible to do it with any anymail providers? ps: I want to reply the same email I have sent from anymail, not an email I have received. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
This isn't really specific to Anymail or any particular ESP. Each email client app has its own rules about when it groups messages into conversations. (So you might find better info searching for "grouping conversations in Gmail" in a more general forum like Stack Overflow.) My memory (which could be wrong!) is that Gmail conversations are based almost entirely on matching the email's subject and the participants (from and to addresses). So if your first message has the subject "Your report", later messages will be grouped in the same conversation as long as you send them with the same from and to addresses and a similar subject—e.g., "Re: Your report". Some other email clients try to match the In-Reply-To and/or References email headers. If those headers match the Message-ID header from an earlier email, the client will group those messages into a conversation. If you were replying to a message you received, you would use the value of that message's Message-ID for your In-Reply-To. But since you want to send the first email yourself, how to get the original Message-ID depends on the ESP. Some ESPs will let you set your own Message-ID when you send the message, which makes it easy: # For first message:
first_message_id = email.utils.make_msgid()
first_message.headers["Message-ID"] = first_message_id
first_message.send()
# For later "replies":
second_message.headers["In-Reply-To"] = first_message_id
second_message.send() But other ESPs insist on generating their own message ids as you send the message, and will either error or silently override your attempt to provide your own Message-ID header. (Unfortunately, I don't know offhand which ESPs do this.) I believe that Mailgun and Sendinblue return their Message-ID values from the send call, so for those ESPs you could check Bottom line is, you'll probably need to experiment a little with your choice of ESP and the email clients you care most about. |
Beta Was this translation helpful? Give feedback.
This isn't really specific to Anymail or any particular ESP. Each email client app has its own rules about when it groups messages into conversations. (So you might find better info searching for "grouping conversations in Gmail" in a more general forum like Stack Overflow.)
My memory (which could be wrong!) is that Gmail conversations are based almost entirely on matching the email's subject and the participants (from and to addresses). So if your first message has the subject "Your report", later messages will be grouped in the same conversation as long as you send them with the same from and to addresses and a similar subject—e.g., "Re: Your report".
Some other email clients try to mat…