To send emails you need to connect an SMTP server. For example, to send 
emails using your google mail account

mail = auth.settings.mailer
mail.settings.server = 'smtp.gmail.com:587'
mail.settings.sender = 'y...@gmail.com'
mail.settings.login = 'y...@gmail.com:password'

Do you have similar code?

On Friday, 23 November 2012 09:26:57 UTC-6, Daniele wrote:
>
> Hello all,
> I'm wondering why I cannot get the email upon registration to work. I've 
> finally gotten basic emailing to work, but it doesn't seem to send anything 
> automatically upon user registration.
> Here's my db.py file:
>
> from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
> auth = Auth(db)
> crud, service, plugins = Crud(db), Service(), PluginManager()
>
> ## Auth
> db.define_table(
>     auth.settings.table_user_name,
>     Field <http://127.0.0.1:8000/examples/global/vars/Field>('email', 
> length=128, default=''),
>     Field <http://127.0.0.1:8000/examples/global/vars/Field>('password', 
> 'password', length=512, readable=False),
>     Field 
> <http://127.0.0.1:8000/examples/global/vars/Field>('password_verify', 
> 'password', length=512, readable=False),
>     Field 
> <http://127.0.0.1:8000/examples/global/vars/Field>('registration_time', 
> 'datetime', requires=IS_DATETIME 
> <http://127.0.0.1:8000/examples/global/vars/IS_DATETIME>(), writable=False, 
> readable=False, default=request 
> <http://127.0.0.1:8000/examples/global/vars/request>.utcnow),
>     Field 
> <http://127.0.0.1:8000/examples/global/vars/Field>('registration_key', 
> length=512, writable=False, readable=False, default=''),
>     Field 
> <http://127.0.0.1:8000/examples/global/vars/Field>('registration_id', 
> length=512, writable=False, readable=False, default='')
> )
>
> custom_auth_table = db[auth.settings.table_user_name]
> custom_auth_table.email.requires = [
>         IS_NOT_EMPTY 
> <http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY>(error_message='Please
>  input an email address'),
>         IS_EMAIL 
> <http://127.0.0.1:8000/examples/global/vars/IS_EMAIL>(error_message=auth.messages.invalid_email),
>         IS_NOT_IN_DB 
> <http://127.0.0.1:8000/examples/global/vars/IS_NOT_IN_DB>(db, 
> custom_auth_table.email)]
> custom_auth_table.password.requires = [
>         IS_NOT_EMPTY 
> <http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY>(error_message='Please
>  type a password'),
>         IS_STRONG 
> <http://127.0.0.1:8000/examples/global/vars/IS_STRONG>(min=8, special=0, 
> upper=1),
>         CRYPT <http://127.0.0.1:8000/examples/global/vars/CRYPT>()]
> custom_auth_table.password_verify.requires = [
>         IS_NOT_EMPTY 
> <http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY>(error_message='Please
>  retype your password'),
>         IS_EQUAL_TO 
> <http://127.0.0.1:8000/examples/global/vars/IS_EQUAL_TO>(request 
> <http://127.0.0.1:8000/examples/global/vars/request>.vars.password, 
> error_message='Passwords do not match'),
>         CRYPT <http://127.0.0.1:8000/examples/global/vars/CRYPT>()]
>
> auth.settings.table_user = custom_auth_table # tell auth to use 
> custom_auth_table
>
> ## create all tables needed by auth if not custom tables
> auth.define_tables(username=False, signature=False)
>
> # configure auth settings
> auth.settings.long_expiration = 3600*24*30 # one month
> auth.settings.remember_me_form = True
>
> ## configure auth policy
>
> auth.settings.registration_requires_verification = True
> auth.settings.login_after_registration = True
> auth.settings.registration_requires_approval = False
> auth.settings.reset_password_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'
> auth.messages.reset_password = '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=['reset_password'])
>  + \
>     '/%(key)s to reset your password'
>
> auth.settings.register_next = URL 
> <http://127.0.0.1:8000/examples/global/vars/URL>('dashboard')
> auth.settings.login_url = URL 
> <http://127.0.0.1:8000/examples/global/vars/URL>('login')
> auth.settings.login_next = URL 
> <http://127.0.0.1:8000/examples/global/vars/URL>('dashboard')
> auth.settings.logout_next = URL 
> <http://127.0.0.1:8000/examples/global/vars/URL>('index')
>
>
> Any help would be greatly appreciated!
>

-- 



Reply via email to