H i I am trying to put the current time in a email message using the following:-
Enter code here...def index(): import datetime ip = str(request.client) t = str(datetime.datetime.today()) form = SQLFORM.factory( Field('name', requires=IS_NOT_EMPTY()), Field('Date_of_Birth',requires=IS_DATE(format=T('%d/%m/%Y'))), #Field('Form', requires =IS_NOT_EMPTY()), #Field('subject', requires=IS_NOT_EMPTY()), Field('message', requires=IS_NOT_EMPTY(), type='text') ) if form.process().accepted: session.name = form.vars.name session.dob = form.vars.Date_of_Birth session.message = form.vars.message session.time = t x = mail.send(to=['hua-c...@humberstonacademy.co.uk'], subject='SOS HELP', message= "Message from.\nName: "+ session.name +" \nTime: " + time + "\n DoB: " +session.dob + "\nMessage : "+session.message+ ".\n " ) if x == True: response.flash = 'email sent sucessfully.' else: response.flash = 'fail to send email sorry!' #response.flash = 'form accepted.' elif form.errors: response.flash='form has errors.' return dict(form=form) I am getting the following error :- cannot concatenate 'str' and 'datetime.date' objects I get the the same message if I try and put the ip address in the email message. I have converted both time and ip to a string, so not sure why I am getting the error. Thanks G Smith -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.