Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Postmark and SendGrid APIs #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

jadb
Copy link
Member

@jadb jadb commented Jan 2, 2015

Been asked a couple times why not just use SMTP. I thought it would be worth writing a little more in-depth explanation which should also keep me reminded of the real reasons that pushed me to code this for the current application I am working on.

While SMTP is great and PHP's native email function is super easy to get things started, there are other (and I believe better) solutions. The transports that are introduced in this PR are completely independent of each other and fill a single need in the general 'sending a transactional email' context/process.

Pros I find to using every transport type introduced:

API

  • Performance: less interactions required by message (1 vs. 2+)
  • Lower barrier: no need to have any SMTP requirements installed

DatabaseQueue

  • Performance: sending of an email takes way more time than a database write (or any type of queuing)
  • Fail-safe: database writes are transaction aware - if one operation fails, the entire transaction is rolled back
  • Scalability: by modeling the email into queues, it becomes easier to scale in the future by re-implementing a different Queue transport (RabbitMQ, IronMQ, etc.) and leave the actual job to be handled by dedicated worker instances

Note: the DatabaseQueue'd job can then use the SmtpTransport (or any ApiTransport) to send the email.

Any comments/feedback/critic on the above explanation/reasoning or the committed code/implementations below are welcomed (I most probably directly linked you to this page for that exact reason 🎯 ).

@jadb jadb self-assigned this Apr 5, 2015
@theraccoonbear
Copy link

theraccoonbear commented Jun 1, 2016

@jadb just curious what the status of this pull request is. I am ramping up with a Cake3 project using SendGrid and am debating the approach to take.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants