Thanks, Massimo. I compiled Python myself, but it was quite some time
ago, I may have compiled it without pyopenssl. I'll try recompiling
it.

On Mon, Apr 27, 2009 at 2:48 AM, mdipierro <[email protected]> wrote:
>
> I think you either do not have pyopenssl or python was compiled
> without it.
>
> Massimo
>
> On 26 Apr, 13:14, Alexei Vinidiktov <[email protected]>
> wrote:
>> I've almost nailed it.
>>
>> I didn't implement the sendmail3 action, but I did something similar.
>> I've looked at the implementation of the mail method of the Mail class
>> and saw the calls that I didn't use: server.ehlo() and
>> server.starttls().
>>
>> The call to server.starttls() at line 78 in tools.py doesn't work:
>>
>> if self.settings.login:
>>                     server.ehlo()
>>                     server.starttls()
>>                     server.ehlo()
>>                     (username, password) = self.settings.login.split(':')
>>                     server.login(username, password)
>>                 server.sendmail(self.settings.sender, to, msg)
>>
>> The error is "Attribute error: 'module' object has no attribute 'ssl'"
>>
>> Why could that be? It's a Python error, isn't it?
>>
>> If I comment out the lines server.starttls() and server.ehlo(), my
>> sendmail action begins to work.
>>
>> I thought that the user registration form will begin to work too, but
>> it didn't. It behaves the same as before.
>>
>> Will have to dig into the tools.py some more as you suggested in a
>> previous email.
>>
>>
>>
>> On Mon, Apr 27, 2009 at 2:02 AM, mdipierro <[email protected]> wrote:
>>
>> > Interesting.. web2py's mail does somthing like
>>
>> > def sendmail3():
>> >     import smtplib
>> >     conn = smtplib.SMTP('mail.mydomain.com')
>> >     conn.ehlo()
>> >     conn.starttls()
>> >     conn.ehlo()
>> >     loginres = conn.login('[email protected]', 'password')
>> >     conn.sendmail('[email protected]', '[email protected]',
>> > 'sendmail2')
>> >     conn.quit()
>> >     return dict(loginres=loginres)
>>
>> > Can you try this?
>>
>> >     conn.ehlo()
>> >     conn.starttls()
>> >     conn.ehlo()
>>
>> > is important for security else password is sent in the clear to the
>> > email server. perhaps your email server is not setup for TLS.
>>
>> > On 26 Apr, 12:37, Alexei Vinidiktov <[email protected]>
>> > wrote:
>> >> Here's what I've found out.
>>
>> >> For testing purposes I've added two actions to my default controller:
>> >> sendmail and sendmail2. The first (sendmail ) uses the Mail class from
>> >> web2py, and the second
>> >>  (sendmail2) uses the smtplib module directly.
>>
>> >> sendmail() and sendmail2() both work fine on my local server.
>>
>> >> sendmail2() works fine on the remote server (it returns True and sends
>> >> the message), but sendmail() doesn't, it returns False.
>>
>> >> Here's what they look like:
>>
>> >> def sendmail():
>> >>     mail = Mail()
>> >>     mail.settings.server='mail.mydomain.com:25'
>> >>     mail.settings.sender='[email protected]'
>> >>     mail.settings.login= '[email protected]:password'
>> >>     result = mail.send(to=['[email protected]'],subject='From
>> >> Web2py',message='sendmail')
>> >>     return dict(result=result)
>>
>> >> def sendmail2():
>> >>     import smtplib
>> >>     conn = smtplib.SMTP('mail.mydomain.com')
>> >>     loginres = conn.login('[email protected]', 'password')
>> >>     conn.sendmail('[email protected]', '[email protected]', 
>> >> 'sendmail2')
>> >>     conn.quit()
>> >>     return dict(loginres=loginres)
>>
>> >> On Mon, Apr 27, 2009 at 1:00 AM, Alexei Vinidiktov
>>
>> >> <[email protected]> wrote:
>> >> > Thanks for your input, Massimo.
>>
>> >> > It's got to be it. If I deliberately change the smtp info on my local
>> >> > server to be incorrect, the app behaves the same as on the remote
>> >> > server.
>>
>> >> > I've tried to send an email from the python shell at the remote server
>> >> > via ssh and it worked fine.
>>
>> >> > What can I do to investigate the issue further?
>>
>> >> > Thanks.
>>
>> >> > On Sun, Apr 26, 2009 at 11:08 PM, mdipierro <[email protected]> 
>> >> > wrote:
>>
>> >> >> I think the problem is that there is a failure to send the
>> >> >> confirmation email. It is either the remote server not accepting the
>> >> >> smtp connection or, if you are using a third party smtp server, cold
>> >> >> be a firewall issue.
>>
>> >> >> Massimo
>>
>> >> >> On Apr 25, 11:52 pm, Alexei Vinidiktov <[email protected]>
>> >> >> wrote:
>> >> >>> On Sun, Apr 26, 2009 at 12:45 PM, Alexei Vinidiktov
>>
>> >> >>> <[email protected]> wrote:
>> >> >>> > On Sat, Apr 25, 2009 at 6:32 PM, Alexei Vinidiktov
>> >> >>> > <[email protected]> wrote:
>> >> >>> >> On Sat, Apr 25, 2009 at 2:30 PM, Alexei Vinidiktov
>> >> >>> >> <[email protected]> wrote:
>> >> >>> >>> Hello,
>>
>> >> >>> >>> I'm beginning to learn user authentication. I've implemented a 
>> >> >>> >>> very
>> >> >>> >>> basic authentication using the Auth module that works fine on my 
>> >> >>> >>> local
>> >> >>> >>> machine: I can register a user, a confirmation email is sent out, 
>> >> >>> >>> the
>> >> >>> >>> user can confirm his email, login and logout.
>>
>> >> >>> >>> I copied the app to a remote server and tried to register a user, 
>> >> >>> >>> but
>> >> >>> >>> after I entered all the user information and hit Submit I got
>> >> >>> >>> redirected back to the registration page and no email was sent to 
>> >> >>> >>> the
>> >> >>> >>> user being registered, no ticket was generated either.
>>
>> >> >>> >>> I'd appreciate any clues.
>>
>> >> >>> >>> I'm using web2py 1.59. My local machine is a WinXP box, the remote
>> >> >>> >>> server is on a Linux distro.
>>
>> >> >>> >> Additional info:
>>
>> >> >>> >> After my unsuccessful attempt to register I was redirected to the 
>> >> >>> >> same
>> >> >>> >> registration page (which is just a scaffold provided by web2py) and
>> >> >>> >> then I looked at the session info by clicking on the corresponding
>> >> >>> >> button and it said "auth : None, flash : Invalid email", but no 
>> >> >>> >> flash
>> >> >>> >> was shown to the user (i.e. to me). I tried different email, but
>> >> >>> >> always got the same flash : invalid email in the session info.
>>
>> >> >>> > I've updated my web2py installation on the remote server to the 
>> >> >>> > latest
>> >> >>> > version, but it didn't help.
>>
>> >> >>> > Do you have any guesses at all as to what may be happening?
>>
>> >> >>> Another piece of information.
>>
>> >> >>> Logging in and logging out both do seem to work on the remote server,
>> >> >>> only registration of new users doesn't work.
>>
>> >> >>> --
>> >> >>> Alexei Vinidiktov
>>
>> >> > --
>> >> > Alexei Vinidiktov
>>
>> >> --
>> >> Alexei Vinidiktov
>>
>> --
>> Alexei Vinidiktov
> >
>



-- 
Alexei Vinidiktov

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to