Comments (4)
Hmm, I'm not sure what's happening here. Everything looks OK to me in the code you've shown. (And it's a clever way to convert Mailgun special headers from your existing code into SES params.)
Your shell example shows the SESv2 client was created successfully and does have a send_email
function as expected. (<bound method ... of <botocore.client.SESV2 object ...>>
is the correct value for c.client.send_email
. In the shell, you could call it using c.client.send_email(params...)
.)
Some ideas to check:
-
Is there any reason your shell test could be different from the environment where you're getting the error? Maybe different boto3 credentials or region?
-
Is there any other code in your custom SESBackend? (Anything that might be altering its
client
attribute?) -
Does this happen on every attempt to send, or do some sends work? Has this worked before and is broken now, or is this new code? (Standard debugging questions—apologies if you've already worked through this.)
To get more info, you might try wrapping the post_to_esp
method to capture more info—in particular, what's actually in self.client at the time:
class SESBackend(AnymailBackend):
def post_to_esp(self, payload, message):
try:
getattr(self.client, payload.api_name)
except AttributeError:
# Include repr(self.client) in the error message:
raise NotImplementedError(
f"{self.client!r} does not have attr {payload.api_name!r}."
) from None
return super().post_to_esp(payload, message)
def build_message_payload(self, message: Any, defaults: Any) -> Any:
...
If self.client ends up being None—or anything other than a botocore.client.SESV2 object—that might suggest some other places to look.
Btw (unrelated to your issue), you can supply the SES ConfigurationSetName directly in your settings.py ANYMAIL dict if you prefer, rather than using esp_extra (docs):
ANYMAIL = {
...,
"AMAZON_SES_CONFIGURATION_SET_NAME": "<name>",
}
from django-anymail.
@andraantariksa any more info on this? As I said earlier, I don't see any explanation for the error you saw in the code you included, and your Django shell test seems to show it's working correctly.
from django-anymail.
Sorry, I still can't reproduce the issue
from django-anymail.
I'm guessing maybe you were running with an older version of django-anymail in the environment where the error occurred, and had some problem with your boto3 credentials. That would make this a duplicate of #308. (Or perhaps you were running with an older version of boto3 that didn't support SES v2, which could cause a similar error.)
If you see the problem again and can provide more info, please add it here and I'll reopen the issue.
from django-anymail.
Related Issues (20)
- Add support to Unisender Go HOT 2
- Support Brevo batch sending with merge_data HOT 2
- Add batch sending support for Resend HOT 1
- Mailgun webhooks: AttributeError 'NoneType' object has no attribute 'get' HOT 1
- Bad UTF-8 "To" header encoding? HOT 8
- Tests fail with error "AppRegistryNotReady: Apps aren't loaded yet"
- Tests fail with error "django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet" HOT 4
- New feature: per-recipient merge_headers
- Amazon SES: support extra_headers, metadata, tags for template sends
- Brevo `trace_clicks` and `trace_opens` HOT 2
- `ses:SendRawEmail` permission still required in v11 for Amazon SES when using `django.core.mail.send_mail`? HOT 3
- Brevo Webhook Mapping Updates HOT 4
- A boto3 problem? HOT 5
- Mailgun Inbound: Empty Attachments When Receiving Emails from Gmail Web HOT 7
- BCC not delivering with Mandrill? HOT 1
- Issue parsing delivery delays from Postmark HOT 2
- Consider type hints for user inputs HOT 5
- Support `send_at` for Resend
- Unisender GO raises AnymailWebhookValidationFailure on some webhook events HOT 1
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 django-anymail.