librelist archives

« back to archive

Flask-Mail smtplib.SMTPRecipientsRefused

Flask-Mail smtplib.SMTPRecipientsRefused

From:
Daniel Nümm
Date:
2011-05-23 @ 11:42
Hi,

the Flask-Mail extension breaks with the following error

        smtplib.SMTPSenderRefused: (530, '5.5.1 Authentication Required.
        Learn more at\n5.5.1
        http://mail.google.com/support/bin/answer.py?answer=14257
        j18sm2290649faa.42', 'daniel.nuemm@googlemail.com')

I read about some problems using gmail so I try an other Account
(Rackspace Mail) 

        smtplib.SMTPRecipientsRefused: {'dn@alphalog.ae': (554, '5.7.1
        <dn@alphalog.ae>: Sender address rejected: Access denied')}


And Yes I check the Passwords ;) 

My Code:

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

from flask import Flask
from flaskext.mail import Mail, Message

app = Flask(__name__)

# Rackspace
#app.config["MAIL_SERVER"] = "secure.emailsrvr.com"
#app.config["MAIL_USE_TLS"] = True
#app.config["MAIL_USE_SSL"] = False
#app.config["MAIL_USERNAM"] = "dn@alphalog.ae"
#app.config["MAIL_PASSWORD"] = "123"


# GMail
app.config["MAIL_SERVER"] = "smtp.gmail.com"
app.config["MAIL_USE_TLS"] = True
app.config["MAIL_USE_SSL"] = False
app.config["MAIL_USERNAM"] = "daniel.nuemm@googlemail.com"
app.config["MAIL_PASSWORD"] = "123"

app.config["MAIL_FAIL_SILENTLY"] = False
mail = Mail(app)

users = [{ "name":u"Daniel Nuemm", "email":"dn@alphalog.de" }]

with mail.connect() as conn:
    for user in users:

        print user["email"]

        # GMail
        msg = Message("Hallo",sender="daniel.nuemm@googlemail.com")

# Rackspace
        #msg = Message("Hallo",sender="dn@alphalog.ae") # Rackspace

        msg.recipients=[user["email"]]
        
        msg.body = "Text message"
        msg.html = "HTML message"

        conn.send(msg)
            
            


Re: [flask] Flask-Mail smtplib.SMTPRecipientsRefused

From:
Wilson Xu
Date:
2011-05-24 @ 02:10
How about specifying TLS port 587 (
http://mail.google.com/support/bin/answer.py?answer=13287
) for gmail since I don't see you use one?

Good Luck!

-- 
Think and code - imwilsonxu.net

Re: [flask] Flask-Mail smtplib.SMTPRecipientsRefused

From:
Ron DuPlain
Date:
2011-05-23 @ 16:51
Hi,

On Mon, May 23, 2011 at 7:42 AM, Daniel Nümm <dn@alphalog.ae> wrote:
> the Flask-Mail extension breaks with the following error
>
>        smtplib.SMTPSenderRefused: (530, '5.5.1 Authentication Required.
>        Learn more at\n5.5.1
>        http://mail.google.com/support/bin/answer.py?answer=14257
>        j18sm2290649faa.42', 'daniel.nuemm@googlemail.com')
>
>        smtplib.SMTPRecipientsRefused: {'dn@alphalog.ae': (554, '5.7.1
>        <dn@alphalog.ae>: Sender address rejected: Access denied')}
>
> My Code:
>
> #app.config["MAIL_USERNAM"] = "dn@alphalog.ae"
> app.config["MAIL_USERNAM"] = "daniel.nuemm@googlemail.com"

This configuration looks suspect.  Do you have MAIL_USERNAM (as typed
above) or MAIL_USERNAME?

-Ron

Re: [flask] Flask-Mail smtplib.SMTPRecipientsRefused

From:
Daniel Nümm
Date:
2011-05-24 @ 11:22
Thanks Ron,

I must be blind. I look at this all the time :/ 

Daniel



Am Montag, den 23.05.2011, 12:51 -0400 schrieb Ron DuPlain: 
> Hi,
> 
> On Mon, May 23, 2011 at 7:42 AM, Daniel Nümm <dn@alphalog.ae> wrote:
> > the Flask-Mail extension breaks with the following error
> >
> >        smtplib.SMTPSenderRefused: (530, '5.5.1 Authentication Required.
> >        Learn more at\n5.5.1
> >        http://mail.google.com/support/bin/answer.py?answer=14257
> >        j18sm2290649faa.42', 'daniel.nuemm@googlemail.com')
> >
> >        smtplib.SMTPRecipientsRefused: {'dn@alphalog.ae': (554, '5.7.1
> >        <dn@alphalog.ae>: Sender address rejected: Access denied')}
> >
> > My Code:
> >
> > #app.config["MAIL_USERNAM"] = "dn@alphalog.ae"
> > app.config["MAIL_USERNAM"] = "daniel.nuemm@googlemail.com"
> 
> This configuration looks suspect.  Do you have MAIL_USERNAM (as typed
> above) or MAIL_USERNAME?
> 
> -Ron