Awesome Tracey.

Almost all of my doubts regarding django emailing are gone. Except
One. Assuming I haven't set anything in the settings regarding
emailing. So NO EMAIL_HOST_USER, nothing else... I try sending the
email from the django shell(python manage.py shell) to
somevalidu...@xyz.com, using some arbitrary from_email id and not
supplying auth_user and auth_password in the send_email call? Where
will the email be? This context is assuming local sendmail is up and
running.

On Jan 29, 12:08 am, Karen Tracey <kmtra...@gmail.com> wrote:
> On Wed, Jan 28, 2009 at 1:39 PM, madhav <madhav....@gmail.com> wrote:
>
> > To add to my previous reply....
> > Even EmailMessage class has got from_email attribute which means it
> > can have dynamic EmailMessage.
> > If it has to only pick settings.EMAIL_HOST_USER, why would it require
> > a atttribute called from_email?
>
> EMAIL_HOST_USER (and password) are used to login to the SMTP server:
>
> http://docs.python.org/library/smtplib.html#smtplib.SMTP.login
>
> This step is optional -- not all mail servers require login.
>
> The From address you specify when calling one of the Django routines to send
> mail is passed along as the from address when sending the mail:
>
> http://docs.python.org/library/smtplib.html#smtplib.SMTP.sendmail
>
> A "from" address is not optional when sending mail, so it has to be
> specified.
>
> The question then arises, what does the SMTP server do when these two values
> do not match?  A user has authenticated using one identity but then sends
> mail claiming to be from some other identity.  Apparently some (at least
> gmail, I don't know how others behave, and as I said earlier this may be
> required behavior) just ignore the value set for "from" and use the
> authenticated identity as "from".
>
> If you want to send mail that appears to be from your users, I think this
> will be hard to do if you are using an SMTP server that requires login.  You
> will need to ensure all your users have logins on the SMTP server you are
> using, and you will need to use the Python smtplib routines directly to
> create the connection, login using the user's id and password, and then send
> the mail.  (Django has only one setting for the SMTP login/pw --
> EMAIL_HOST_USER and EMAIL_HOST_PASSWORD -- to use when connecting to the
> mail server, and I don't expect extending that to support what you are
> talking about would be high on the list of things to add.)
>
> If you happen to be using an SMTP server that does not actually require
> login, though, getting what you are looking for may be as simple as removing
> the EMAIL_HOST_USER and EMAIL_HOST_PASSWORD settings from your
> configuration.  Then the Django mail utility routines will not login to the
> server, and there will be no conflict between the logged-in identity and the
> From identity specified in the mail.
>
> Karen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to