Skip to content
This repository has been archived by the owner on May 6, 2018. It is now read-only.

SendEmail handler: Don't tell users the email sent correctly if it may not have #26

Closed
elimisteve opened this issue Feb 16, 2014 · 0 comments
Assignees

Comments

@elimisteve
Copy link
Member

We could either say it was successfully attempted (lol), that it was successfully added to the mail queue (my vote), or just block and tell them whether it succeeded or failed.

Mail Queue

How about we return to them the saved *Email (as JSON) so they have the ID and as to return immediately. We can then save a corresponding EmailStatus object (see #19) then allow them to query the server to check the status (perhaps via GET requests to /email/{id}/status).

Web Hooks

We could also have web hook-like functionality, where the request could include an optional callback_url field that the email service POSTs to once the status of the attempted email sending has either succeeded or failed (the JSON in the POST could say which, so I guess it should be an EmailStatus).

Blocking Option

We could also provide an option where the sending is synchronous and the remote client waits till the email has been sent. But since there would be no guarantee that the send would either succeed or fail while the client was waiting -- especially before it timed out -- this might not work very well. In practice it would work for our use case, but I think it'd be bad practice to get used to doing things that work for small projects but would never work at scale.

I know what would be good practice though (for you using select): the call to .Send() could wait up to 30 seconds, at which point the EmailStatus is returned to the client with whatever status -- QUEUED, PENDING/SENDING, SUCCESS, FAILED. Then the client could at least do GETs to /email/{id}/status to find out what happened (and could also include a callback_url to get the response web hook-style).

@elimisteve elimisteve added this to the MVP: Version 0.1 milestone Feb 16, 2014
ajvb added a commit that referenced this issue Feb 21, 2014
Added async email.SaveAndSend() within the SendEmail
POST handler and changed the response to 'added
to the queue' rather than 'sent successfully';

related to #26 #20
@ajvb ajvb closed this as completed Feb 21, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants