zapier/django-drip — pull request #16 by brad (2012-11-16 01:05:08+00:00)
Title: Custom sender

Hey guys,
I needed to send drips via SMS, so I modified django drip to make things more generic and allow custom senders.
After submitting this request I realized it would probably be better to create a new migration rather than edit existing ones. Before I do that though, I want to gauge interest. Is this even a feature you want?
Here is the documentation for the new feature (also added to the README). I suppose some new screenshots would also be needed.

-------------------

### Custom Sender

If you want to send messages different from the default sender (SMTP),
you can create a custom sender class that inherits from `SenderBase`. For example:

```python
from drip.models import SenderBase

class CustomSender(SenderBase):
# drip is the drip.drips.DripBase object which gives access to
# from_address and from_address_name
def send_message(self, drip, user, subject, body, plain):
# Custom sending logic (SMS, in app messaging, snail mail, etc.)
...
# Return a boolean indicating if the message was sent or not
```

After adding this table to the database using syncdb or a south migration, you
will need to create an object of this type:

```shell
$ python manage.py shell
>>> from exampleapp.models import CustomSender
>>> sender = CustomSender()
>>> sender.name = 'My Custom Sender'
>>> sender.save()
```

Now when you create a `Drip` in the django admin you will have the option of
selecting your own custom sender. When these `Drip`s go out, django drip will
send the message with your custom sender instead of the built-in method.

-------------------