How to Schedule Mail Using Gmail API

Is there any way to schedule mail using gmail api?

The Gmail API has no scheduling functionality. You could solve it by temporarily holding the email on your own server as Jorden mentioned in the comments, or you could look into the App Engine Cron Service.

How to schedule an email at a specific date and time, with the gmail api?

I think that you are looking for a Queue/Worker/Jobs, Laravel implements it out of the box, you can check it here.

Remember that to process your queue you must have a second php artisan process running in your server to handle the queue, you could also use services like redis to process it.

Hope it helps you =)

Gmail now supports scheduling emails, how does is work using the gmail rest api, or is the api supporting this feature?

It says from this SO post that Gmail API has no scheduling functionality therefore as well as using Gmail REST API. You could probably Scheduling Tasks With Cron for Python that allows you to configure regularly scheduled tasks that operate at defined times or regular intervals.

As sender, using API or headers, is it possible to detect if an email was sent using Gmail's “Schedule Send”?

Issue:

By default you cannot detect that. The message headers don't include any information related to that, and the API's Message resource doesn't have any field which can clarify that.

Also, even though Scheduled is a reserved system label and so labels cannot be created with that name:

Sample Image

Scheduled is not a label which can be found in the API (e.g. by calling users.labels.list), so you cannot filter messages (e.g. using users.messages.list) according to whether they have this label.

Workaround:

  • Create a custom label for schedule messages, and apply this label to these messages:

Sample Image

You can then list the messages that contain this label.

  • To do that, you should first retrieve the corresponding labelId, which you can fetch by first calling users.labels.list.

  • And then call users.messages.list and add the previous id to labelIds, so that only messages with this label are returned:

Sample Image

File a Feature Request:

I'd suggest you to file a Feature Request in the corresponding Issue Tracker's component, so that scheduled messages can be programmatically listed through Gmail API.



Related Topics



Leave a reply



Submit