Ok I got basic emailing to work. Here's what the problem was:

When I made my project, I used the wizard. The wizard created a file called 
0.py (GREAT NAME) that was overriding my mail.settings.* variables. So no 
matter how I set them, they'd get overwritten with things like ' '

Anyways, the basic e-mailing seems to work now. What doesn't work is the 
e-mail upon registration, which I set with 

auth.settings.registration_requires_verification = True
auth.messages.verify_email = 'Click on the link http://' + \
    request <http://127.0.0.1:8000/examples/global/vars/request>.env.http_host 
+ \
    URL <http://127.0.0.1:8000/examples/global/vars/URL>(r=request 
<http://127.0.0.1:8000/examples/global/vars/request>,f='user',args=['verify_email'])
 + \
    '/%(key)s to verify your email'

Are these values also being overwritten somewhere that you guys know of??

Thanks

P.S.
What a poor design decision to have mail.settings in the db.py file, then 
at the bottom have them reference another variable in a file called 
0.py....seriously??

On Wednesday, November 21, 2012 7:32:26 PM UTC, Daniele wrote:
>
> I'm trying to send emails upon user registration. This is what I have in 
> my models file:
>
> mail = auth.settings.mailer
> mail.settings.server = 'smtp.gmail.com:587'
> mail.settings.sender = 'em...@gmail.com' #There's a proper email here
> mail.settings.login = 'username:password' #There's a proper 
> username/password combination here
> auth.settings.registration_requires_verification = True
> auth.messages.verify_email = 'Click on the link http://' + 
> request.env.http_host + URL(r=request,f='user',args=['verify_email']) + 
> '/%(key)s to verify your email'
>
> mail.settings.server = settings.email_server
> mail.settings.sender = settings.email_sender
> mail.settings.login = settings.email_login
>
> But every time I register a user with a valid email address, I'm getting 
> no email.
> So I'm trying to do it manually with:
>
> mail.send('em...@gmail.com', 'Message subject', 'Plain text body of the 
> message')
>
>
> But I'm getting an error message in the terminal that says:
> WARNING:web2py:Mail.send failure:[Errno 111] Connection refused
>
> How can I fix this???
>

-- 



Reply via email to