Comments (5)
Hi @Aduril and @jarvisjohnson, thanks so much for being quick to look through this. You're right that the main changes in Bamboo 2.0 are to the Bamboo.Mailer
API. But in order for that change to work — for bamboo and bamboo_smtp users to be able to handle errors when emails fail to deliver — we also need to change what the adapter's deliver/2
function returns (See the changes to the adapter deliver
callback):
- @callback deliver(%Bamboo.Email{}, %{}) :: any
+ @type error :: Exception.t() | String.t()
+ @callback deliver(%Bamboo.Email{}, %{}) :: {:ok, any} | {:error, error}
That means adapters should no longer raise errors in the adapter code when failing to deliver emails. Instead they should return an {:error, error}
tuple, so that Bamboo can handle that. Looking at the smtp_adapter.ex
file, my guess is that these are the lines that should now return an error instead of raising one:
bamboo_smtp/lib/bamboo/adapters/smtp_adapter.ex
Lines 98 to 108 in 2c2643e
If instead of raise SMTPError
, bamboo_smtp returns {:error, %SMTPError{}}
, then users who call Mailer.deliver_now
will get that error tuple back. The users can then handle that in whatever way they see fit (e.g. retrying to send, or keeping a log of what failed, etc.)
For users who call Mailer.deliver_now!
, Bamboo will raise
the error the adapter passes back, so it'll do an raise %SMTPError{}
.
As for the successful case, it seems that bamboo_smtp already returns an {:ok, response}
, so that's perfect.
Does all that make sense?
from bamboo_smtp.
Since the pull request #177 that address to this issue was merged I am closing it.
thanks all for the contribution 🙂.
from bamboo_smtp.
As far as I see the the major change is towards the API of Bamboo.Mailer
(please do not trust my word, check for yourself).
So the change should be an easy version upgrade, right?
from bamboo_smtp.
I think @Aduril is right, bumping the bamboo version seems to be all that is needed.
Have created a PR for this - #177
from bamboo_smtp.
Totally, thanks - I'll make some updates for it to return an :error tuple
from bamboo_smtp.
Related Issues (20)
- problem with eml attachment HOT 1
- Getting TLS error when sending email HOT 2
- Refactor the way we add attachments to emails
- Issue when providing a custom config and using response: true HOT 1
- Connect per IPv6 HOT 7
- {:nocatch, {:permanent_failure, "501 Invalid command or cannot parse to address\r\n"}} HOT 1
- Subject character encoding HOT 7
- SendGrid will soon stop supporting auth with username and password HOT 2
- Cannot install dependency on phoenix 1.5.7 HOT 6
- Cannot install dependency on phoenix 1.5.7 HOT 1
- Update gen_smtp to 1.1.1
- Warnings after upgrading to otp-24 HOT 17
- function :crypto.hmac/3 is undefined or private HOT 7
- Support for Bamboo 2.2 HOT 1
- Upgrading to Heroku-20 stack (Ubuntu 20.04) seems to cause emails to not be sent HOT 2
- bamboo_smtp dependencies warning (hut) HOT 3
- Problem Encoding Comma in Filename HOT 1
- Upgrade Bamboo dependency from 2.2.0 to 2.3.0
- Dead project? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bamboo_smtp.