emencia / emencia-django-newsletter

An app for sending newsletter by email to a contact list.
189 stars 72 forks source link

Using TLS and gmail #2

Closed curaloucura closed 14 years ago

curaloucura commented 14 years ago

Hello, I was having a problem sending newsletter using a gmail account and I had to change the tls implementation so it could work. On mailer.py I changed the smtp_connect method to:

def smtp_connect(self):
    """Make a connection to the SMTP"""
    server = self.newsletter.server
    self.smtp = SMTP(server.host, int(server.port))
    if server.tls:
        #having to do this because of google
        self.smtp.ehlo()
        self.smtp.starttls()
        self.smtp.ehlo()
    if server.user or server.password:
        self.smtp.login(server.user.encode('utf-8'), server.password.encode('utf-8'))

I don't couldn't try on any other TLS, so I'm not sure if it will work for other situations

Fantomas42 commented 14 years ago

Ok, thank for the report.

I will reproduce the bug, use your patch and try on another SMTP using TLS.

But it's appear you are experiencing the same bug of Martip. And GMail seems to be a good thing for starting debugging.

Fantomas42 commented 14 years ago

I have tried to use the GMail SMTP, effectively it doesn't work, but I fixed it. In fact, this part was rewrited.

curaloucura commented 14 years ago

Great, thanks! I will update my for