Why does sending an email return a 409 error with the response "is currently being saved"?

The issue with sending is caused by the draft being sent before it's saved on the provider. Previously we were not always exposing the failure, as a result, our backend was continuously retrying hiding the underlying issue.

There are two potential fixes here:

  • Quickest: Remove the draft.save() step and send message directly
  • If saving the draft then confirm draft is created via job-status endpoint or webhook.

Method 1: Don't create a draft and send it directly via POST /send.
An example of how to do this via the Python SDK, remove the draft.save step.

draft = nylas.drafts.create()
draft.body = "This is a message from the Nylas Python SDK"
draft.to = [{"name": "My Nylas Friend", "email": "abc@gmail.com"}]


Method 2: Confirm the Draft has been created before sending, by checking the job-status

Or a quicker, temporary method with minimal code to get everything working, wait ten seconds between draft and send, this can happen in the backend without affecting the user experience. This is not a long-term solution, best practice if using drafts is to check the job_status_id  has completed.



Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request



Please sign in to leave a comment.