Neither "device" nor "date_time" are included in your form, so of course 
they are not in form.vars.

Anthony

On Sunday, June 12, 2016 at 11:51:03 AM UTC-4, Steve Joe wrote:
>
> Please look at my code and let me know why I am getting emails in such a 
> way:
>
>
> device=str(request.user_agent)
> start=device.find("HTTP_USER_AGENT") + 18
> end=device.find("HTTP_CONNECTION") - 3
> device=device[start:end]
>
> db.define_table('pokes',
>                 Field('name',requires=IS_NOT_EMPTY(error_message="Please 
> enter your name")),
>                 Field('email_id',requires=IS_EMAIL()),
>                 Field('msg','text', label='Message'),
>                 Field('device',default=device),
>                 
>  
> Field('date_time','datetime',default=request.utcnow+datetime.timedelta(0,19800))
>                       )
>
>
> In controller:
> form=SQLFORM(db.messages, fields=['name', 'email_id','msg']).process()
>     if form.accepted:
>         mail.send(['[email protected]'],
>                   'A new message on your EPORTFOLIO!',
>                  '<html><div style="background-color:lightblue">%s 
> said:<br>%s<br>His/her email id: %s<br>Logged in from %s<br>Message sent 
> at: %s</div></html>' %(str(form.vars.name), str(form.vars.msg), 
> str(form.vars.email_id), str(form.vars.device), str(form.vars.date_time)))
>
>
> However in db values are being inserted correctly.
> EMAIL THAT I AM GETTING:
> .kmk said:
> ljk,
> His/her email id: [email protected]
> Logged in from None
> Message sent at: None
>
>

-- 
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