0

I try to figure out how I can implement the GMAIL API with PHP.

My Application should only create draft/send messages.

I was successful to create a draft and send it with the gmail api.

My problem is, I should send, after some time is passed, another mail. But not create a new mail message/thread but use the existing thread.

It should work, because when i create a draft, i've already a messageID.

Have anyone an idea. I don't found a anything at GoogleApi and on youtube.

Best regards.

Setaloro
  • 41
  • 5

1 Answers1

0

Based from this documentation, a draft can be added to a thread as part of creating, updating, or sending a draft message. You can also add a message to a thread as part of inserting or sending a message.

If you are sending or migrating messages that are a response to another email or part of a conversation, your application should add that message to the related thread. This makes it easier for Gmail users who are participating in the conversation to keep the message in context.

Make sure that the requested threadId is specified on the Message or Draft.Message you supply with your request; the References and In-Reply-To headers are set; and the Subject headers match.

You can also check this another SO thread which stated why some mails are not threaded.

The answer to why they are not threaded in Gmail is because Gmail's threading is done according to the subject of the messages (it is not based on the "in-reply-to" or "references" field in the header).

See the answers to this question on stackexchange for more details on how Gmail does threading: https://webapps.stackexchange.com/questions/965/how-does-gmail-decide-to-thread-email-messages..

The subjects in your case are "This is test email 1", "This is test email 2" and "This is test email 3" which will not cause threading by the rules Gmail use.

Hope this helps!

Community
  • 1
  • 1
abielita
  • 13,147
  • 2
  • 17
  • 59