Skip to content

Instantly share code, notes, and snippets.

@epicserve
Created July 25, 2011 22:50
Show Gist options
  • Save epicserve/1105465 to your computer and use it in GitHub Desktop.
Save epicserve/1105465 to your computer and use it in GitHub Desktop.
Django-ses Return-Path/Source Patch
From 312aada9b74320de3599b6f19e6350e3538cde72 Mon Sep 17 00:00:00 2001
From: Brent O'Connor <epicserve@gmail.com>
Date: Mon, 25 Jul 2011 15:32:24 -0700
Subject: [PATCH] Added a way to change the source so that bounce messages are
sent to the return_path of the message if the return_path
is set.
---
django_ses/__init__.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/django_ses/__init__.py b/django_ses/__init__.py
index 81da9bd..a199f8a 100644
--- a/django_ses/__init__.py
+++ b/django_ses/__init__.py
@@ -65,8 +65,9 @@ class SESBackend(BaseEmailBackend):
num_sent = 0
for message in email_messages:
try:
+ source = getattr(message, 'return_path', message.from_email)
response = self.connection.send_raw_email(
- source=message.from_email,
+ source=source,
destinations=message.recipients(),
raw_message=message.message().as_string(),
)
--
1.7.4.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment