Send existing draft in GMail from PHP

194 Views Asked by At

So I have a bit of a complicated question, and I'm not even sure if this is even possible, but please leave any suggestions.

I am looking for a way to send precomposed drafts made in GMail through PHP. This will be used for an (semi-)automated payment confirmation system. This is the outline of the system:

  1. Customer comes in with a request.
  2. Company writes e-mail in advance, which should be sent as soon as the customer pays. This e-mail contains some text and an attachment.
  3. Customer pays.
  4. Payment system sends a message to my server. My script extracts all the information needed.
  5. Script accesses GMail account and sends the existing draft (which can be distinguished by looking at the subject).

Basically what I need is a way to implement step 5.

Again, this is probably a long shot but any help is appreciated.

1

There are 1 best solutions below

0
On

Do you know Gmail API? You can create drafts, send emails and attach documents from PHP.

https://developers.google.com/gmail/api/downloads