First off, thanks to the community for a well written framework. The documentation is very nice and full of examples.I thought I'd ask here, as I couldn't be the only want who didn't want a text "verify email" to be sent out in lieu of nice, colorful, css heavy html emails.I want do the following to set an email template for auth.messages.verify_email.message = 'Click on the link https://' +request.env.http_host +URL(r=request,c='default',f='user',args=['verify_email']) + '/%(key)s to verify your email'context = dict(message=message)auth.messages.verify_email = response.render('emailtemplates/standard_email.html', context)The problem is, because I have CSS in the template, I get the following error.<type 'exceptions.ValueError'> unsupported format character ';' (0x3b) at index 316
Anyone else have this problem? I thought about modifying tool.py to useself.messages.verify_email_context['key'] = key
message = response.render(self.message.verify_email_template,self.messages.verify_email_context) #and put {{=key}} in the templateinstead ofmessage=self.messages.verify_email % dict(key=key)A similar question was asked here, but I didn't get any resolution from the answer, as I'm having issues.
I have replaced the standard verification with my own. The standard authentication is pretty simple as it creates a unique key, which it stores in the database and sends as a link to the registrant. When the link is clicked it will match the registration details with the unique id and stores (accepts the user) them.
This way you can customize the template and use email API (json), which is much more powerful than smtp method (I use mailgun).
Ykä
--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/NbLduKZR_4k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
...
# This code should run when the users posts the form with all required data, and after doing some validation to the data provided
from gluon.tools import web2py_uuid
registration_key = web2py_uuid()db.auth_user.insert(\
first_name=form.vars.first_name, \ last_name=form.vars.last_name, \ email=form.vars.email, \ password=db.auth_user.password.validate(form.vars.password)[0], \ registration_key=registration_key)mail.send(to=form.vars.email, subject='Confirm your registration', \ message='Hi %s, thanks for registering in our website!\n\n' %first_name + \ 'To finish the registration, please click on the next link:\n' + \ '%s\n\n' %URL('default', 'user/verify_email/%s' %registration_key, host=request.env.http_host))registration_key = request.args(1)
user = db(db.auth_user.registration_key==registration_key).select().first()if not user: redirect(URL('default', 'index'))user.update_record(registration_key='')auth.login_user(user)session.flash = 'Your registration has been confirmed. Thanks!'redirect(URL('init', 'default', 'index'))...
I hope it helps!
message=self.messages.verify_email % dmessage=('',response.render('email/template.html', d))response = current.response