On Tue, Feb 23, 2010 at 8:08 AM, Mat Clayton <[email protected]> wrote:
> Sorry I probably didn't explain this properly. A composite backend is half
> the solution, the other part of the problem is deciding which backend to
> use. This decision in our case needs to be made where mail.send() is called.
> Either I could load in a custom backend here and replace the default one, or
> alternative pass some kwargs through send() to the send_messages() function
> in the backend, allowing the composite backend to choose
> theĀ appropriateĀ backend to use.

I not sure I even understand why a composite backend is required. Just
use two backends.

It's always been possible to have multiple SMTP connections; with the
introduction of email backends, this concept extends to multiple mail
sending connections.

By default, mail.send_mail() just makes a call to get an instance of
the default connection, using the configuration values in the settings
file. However, you can manually instantiate a connection with whatever
settings you want, and provide connection to send_mail() or
EmailMessage.send()::

conn = mail.get_connection(
                'django.core.mail.backends.smtp.EmailBackend',
                host='mailhost',
                username='me',
                password='s3krit')

mail.send_mail(
    subject='hello',
    message='hello world',
    from_email='[email protected]',
    recipient_list=['[email protected]'],
    connection=conn)

So - set up two connections - one simple EmailBackend, and one
django-mailer style queue (or two EmailBackends using different
ports). Store these connections somewhere helpful, and use them as
appropriate.

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to