Hi Massimo,

I finally found where the problem is. It is something to do with the
SASL CRAM-MD5 authentification at server side. Just to debug purposes,
is there any way to use the 'sasl_method=PLAIN' when using
mail.send()?

thanks a lot,
Bernardo

On 1 dic, 23:38, Bernardo <[email protected]> wrote:
> All right. It seems to load the certificate now. But... still not
> sending the mail. Now web2py prints the following line:
>
> WARNING:web2py:Mail.send failure:(535, '5.7.8 Error: authentication
> failed: authentication failure')
>
> The mail.log in the mail server shows the following lines:
>
> Dec  1 22:35:11 mail postfix/smtpd[3398]: connect from MyIp
> Dec  1 22:35:11 mail postfix/smtpd[3398]: setting up TLS connection
> from MyIp
> Dec  1 22:35:12 mail postfix/smtpd[3398]: Anonymous TLS connection
> established from MyIp: TLSv1 with cipher DHE-RSA-AES256-SHA (256/256
> bits)
> Dec  1 22:35:12 mail postfix/smtpd[3398]: warning: SASL authentication
> failure: no secret in database
> Dec  1 22:35:12 mail postfix/smtpd[3398]: warning: MyIp: SASL CRAM-MD5
> authentication failed: authentication failure
> Dec  1 22:35:12 mail postfix/smtpd[3398]: lost connection after AUTH
> from MyIp
> Dec  1 22:35:12 mail postfix/smtpd[3398]: disconnect from MyIp
>
> So, I guess that there must be a problem with the certificates?
>
> On 1 dic, 23:27, mdipierro <[email protected]> wrote:
>
>
>
>
>
>
>
> > You are using x509 signed emails. You set your certificates with:
>
> > > mail.settings.x509_sign_keyfile = 'url_to_postfix.key'
> > > mail.settings.x509_sign_certfile = 'url_to_postfix.cert'
> > > mail.settings.x509_crypt_certfiles = 'url_to_postfix.cert'
>
> > but they should not be urls, they should be full paths to localfiles.
>
> > On Dec 1, 4:07 pm, Bernardo <[email protected]> wrote:
>
> > > More news Massimo,
>
> > > After following the execution of send method from Mail class, I found
> > > where it throws the exception that makes it return False. Those are my
> > > new mail settings:
> > > mail.settings.server = 'mydomain:25'  # your SMTP server
> > > mail.settings.sender = '[email protected]'         # your email
> > > mail.settings.login = 'berna...@mydomain:mypass'      # your
> > > credentials or None
> > > mail.settings.cipher_type = 'x509'
> > > mail.settings.sign = False
> > > mail.settings.x509_sign_keyfile = 'url_to_postfix.key'
> > > mail.settings.x509_sign_certfile = 'url_to_postfix.cert'
> > > mail.settings.x509_crypt_certfiles = 'url_to_postfix.cert'
>
> > > The exception is thrown in line 502 of gluon/tools.py
> > >  500                     # make an encryption cert's stack
> > >  501                     for x in x509_crypt_certfiles:
> > >  502                         sk.push(X509.load_cert(x))
> > >  503                     s.set_x509_stack(sk)
>
> > > My question, what is the difference between
> > > mail.settings.x509_sign_certfile and
> > > mail.settings.x509_crypt_certfiles
>
> > > Does this info makes things clearer?
>
> > > thanks a lot again and kind regards,
> > > Bernardo
>
> > > On 1 dic, 20:49, Bernardo <[email protected]> wrote:
>
> > > > Ok Massimo,
>
> > > > I'll post if I find something.
>
> > > > thanks a lot!!
> > > > Bernardo
>
> > > > On 1 dic, 19:30, mdipierro <[email protected]> wrote:
>
> > > > > web2py is failing to connect and send the email. Something is wrong in
> > > > > the settings. To debug, you can try add something some print
> > > > > statements inside the class Mail send function. Sorry I do not have a
> > > > > better advice.
>
> > > > > On Dec 1, 12:27 pm, Bernardo Botella Corbí <[email protected]> wrote:
>
> > > > > > It prints
>
> > > > > > False
>
> > > > > > Bernardo
>
> > > > > > 2010/12/1 mdipierro <[email protected]>
>
> > > > > > > try from the shell
>
> > > > > > > python web2py.py -A yourapp -N -M
>
> > > > > > > print mail.send(to="....@...", message="....", subject="...")
>
> > > > > > > Massimo
>
> > > > > > > On Dec 1, 11:55 am, Bernardo <[email protected]> wrote:
> > > > > > > > Hi Massimo,
>
> > > > > > > > thanks for your reply. I connected without problems using 
> > > > > > > > telnet on
> > > > > > > > port 25
>
> > > > > > > > >telnet mydomain.com 25
>
> > > > > > > > Connected to mydomain.com.
> > > > > > > > Escape character is '^]'.
> > > > > > > > 220 mydomain.com ESMTP Postfix (Ubuntu)
> > > > > > > > EHLO mydomain.com
> > > > > > > > 250-mydomain.com
> > > > > > > > 250-PIPELINING
> > > > > > > > 250-SIZE 10240000
> > > > > > > > 250-ETRN
> > > > > > > > 250-STARTTLS
> > > > > > > > 250-AUTH CRAM-MD5 DIGEST-MD5 LOGIN PLAIN
> > > > > > > > 250-ENHANCEDSTATUSCODES
> > > > > > > > 250-8BITMIME
> > > > > > > > 250 DSN
>
> > > > > > > > on the other hand, the username is the same I use to send an 
> > > > > > > > email
> > > > > > > > from thunderbird.
>
> > > > > > > > kind regards,
> > > > > > > > Bernardo
>
> > > > > > > > On 1 dic, 16:49, mdipierro <[email protected]> wrote:
>
> > > > > > > > > try telnet mail.mydomain.com 25 and see if it is accepting 
> > > > > > > > > remote
> > > > > > > > > connections (by defau postfix does not).
>
> > > > > > > > > Also I think
>
> > > > > > > > > mail.settings.login = '[email protected]:mypass'
>
> > > > > > > > > should be
>
> > > > > > > > > mail.settings.login = 'berna...:mypass'
>
> > > > > > > > > On Dec 1, 5:44 am, Bernardo <[email protected]> wrote:
>
> > > > > > > > > > Dear all,
>
> > > > > > > > > > I don't know if it is exactly a web2py issue or not. The 
> > > > > > > > > > fact is that
> > > > > > > > > > I have a remote mail server, listening in port 25. It uses 
> > > > > > > > > > a self
> > > > > > > > > > created certificate to allow connections from the outside 
> > > > > > > > > > (i.e. for
> > > > > > > > > > thunderbird, you must accept that certificate in order to 
> > > > > > > > > > send
> > > > > > > mails).
> > > > > > > > > > The problem is that when I try to send an email:
>
> > > > > > > > > > mail.send(to='[email protected]',subject='Hello world
> > > > > > > > > > subject',message='Hello world text')
>
> > > > > > > > > > but nothing happens. Not a single messange printed on 
> > > > > > > > > > python console.
> > > > > > > > > > And nothing shown in postfix log
>
> > > > > > > > > > The lines in db.py are:
> > > > > > > > > > mail.settings.server = 'mail.mydomain.com:25'
> > > > > > > > > > mail.settings.sender = '[email protected]'         # 
> > > > > > > > > > your email
> > > > > > > > > > mail.settings.login = '[email protected]:mypass'      # 
> > > > > > > > > > your
> > > > > > > > > > credentials or None
> > > > > > > > > > mail.settings.cipher_type = 'x509'
> > > > > > > > > > mail.settings.x509_sign_keyfile = 'url_to_postfix.key'
> > > > > > > > > > mail.settings.x509_sign_certfile = 'url_to_postfix.cert'
>
> > > > > > > > > > Does anyone can figure out what is wrong with all of this?
>
> > > > > > > > > > thanks a lot for your time,
> > > > > > > > > > Bernardo

Reply via email to