Hello I think I have a similar problem.

With an ssl smtp server on port 587 email are going out.
With a tls smtp server on port 25 web2py don't give me an error but mails 
are not sent.

In model:
mail = auth.settings.mailer
mail.settings.server = 'zimbra.mydomain.com:25'
mail.settings.sender = '[email protected]'
mail.settings.login = '[email protected]:mypassword'

In controller:
    email_sent = mail.send(to=['[email protected]'],
                      subject = subject,
                      reply_to=email,
                      message=message)

email_sent=1, but it never go out.

Is there an update about the ticket that you have open ?

Regards

Il giorno giovedì 14 novembre 2013 15:53:19 UTC+1, Kariloy Markief ha 
scritto:
>
> Well I'm not sure where and how to open a ticket but in the meantime I 
> search through the internet for a solution and then the source code and the 
> answer lies in adding
>
> server.esmtp_features["auth"] = "LOGIN PLAIN"
>
> at the right place in Mail class at the gluon/tools.py file.
>
> for my current application case I just did a dirty fix and add that line 
> at the end of the
>
> if self.settings.tls and not self.settings.ssl:
>
> conditional, because those are the settings I'm working under now, so it 
> suits me fine, and it now works.
>
> For a proper fix, it's probably better to add a Mail setting like:
>
> settings.auth = 'plain' (vs 'cram')
>
> or
> settings.plainlogin = True
>
>
> or something like that to make it selectable option, or just catch the 
> error and try again with the "plain mode on"? Not sure what the best coding 
> practices are, but I suppose this information is enough for someone that 
> knows the web2py class Mail well to wip up a real fix in a couple of 
> minutes whereas it would take me hours.
>
> Regardless, if no one picks this up, point me to where I should submit 
> such a change and I'll try and see what I can do over the upcoming weekend. 
>
> Thanks  
>
>
>
>
>
>
>
>
>
> On Thursday, November 14, 2013 1:53:24 AM UTC, Massimo Di Pierro wrote:
>>
>> No but open a ticket. Can you help make it happen?
>>
>> On Wednesday, 13 November 2013 10:45:36 UTC-6, Kariloy Markief wrote:
>>>
>>> Well, sorry to bring this back from the grave but after some hours 
>>> debugging I've come to realize that I'm having the same problem has 
>>> Bernardo. So I was wondering, has by any chance 'sasl_method=PLAIN' have 
>>> been enabled as a possibility since then? Because, if so it isn't being 
>>> obvious to me.
>>>
>>> Thank you. 
>>>
>>> On Thursday, December 2, 2010 2:16:42 PM UTC, mdipierro wrote:
>>>>
>>>> No but I can add that. I will take a look. 
>>>>
>>>> On Dec 2, 4:35 am, Bernardo <[email protected]> wrote: 
>>>> > 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 = 'bernardo@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 
>>>> > 
>>>> >
>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to