a sample (in portuguese, just change the name or fields):
in controller:
def fale_conosco():
form = SQLFORM.factory(
Field('nome', requires=IS_NOT_EMPTY(error_message='Preencha o seu
nome')),
Field('email', requires=IS_EMAIL()),
Field('motivo',requires=IS_EMPTY_OR(IS_IN_SET(['Sugestão','Reclamação','Elogio','Dúvida','Outros']))),
Field('titulo', label = 'Título',
requires=IS_NOT_EMPTY(error_message='Preencha o título')),
Field('mensagem','text', label= 'Descrição',
requires=IS_NOT_EMPTY(error_message='Escreva sua mensagem')),
submit_button="Enviar")
if form.accepts(request.vars, session):
mensagem = form.vars.nome+' '+form.vars.email+'<br>Enviou
'+form.vars.motivo+': <br>'+form.vars.mensagem
context = dict(person=form.vars.email)
status = mail.send(to=['[email protected]'],reply_to=form.vars.email,
subject=form.vars.tipo+' - '+form.vars.titulo ,
message=[None,mensagem])
if status == True:
response.flash='Obrigado por entrar em contato. Responderemos em
breve'
else:
response.flash='Ocorreu um erro e não foi possível enviar sua
mensagem'
else:
response.flash='Preencha os campos solicitados no formulário'
return dict(form=form)
in the view, just use:
{{=form}}
2011/2/3 bee <[email protected]>
> I expect that I am going about this the wrong way but here it
> goes......
>
> I am currently designing a form for my web2py website. When the user
> clicks submit I would like my application to send me the form fields
> via email.
>
> My hosting provider will supply form mail.php files:
> On Linux hosting accounts, this will re-install the "gdform.php",
> "webformmailer.php", and "gdform.cgi" (this is in the "cgi" directory)
> form-mailer scripts for your hosting account
>
> Can I utilize these?
>
>
--
Atenciosamente
Alexandre Andrade
Hipercenter.com Classificados Gratuitos e Inteligentes