Send email from template file I am making a return request page for my website the user will enter in his/her information about their order and it will pull up a list of their order. The information is pulled from the views then submitted to the confirmation page.

I already have the form validation working but I need the validation code written in the page--node--nodeid.tpl.php to send an email to 2 people, the customer and me, using the information from the form.

I've seen drupal_mail(), but this seems like it needs to be used in a module.

Is this even possible?

On a side note it would be helpful to be able to use a template later.
Doing all of this within templates really shouldn't be the way to go. Write a custom module. And then do the following:


Use hook_menu() to create a page. Page callback would be drupal_get_form. Page argument would be YOURMODULE_form.
Inside YOURMODULE_form() you'll create your form. Check Form API for detailed info.
Finally you have to add a submit function YOURMODULE_form_submit() where you do your processing and use drupal_mail() to build and send your emails.


Maybe look at a little module I once wrote myself that follows a similar approach, form to mail, only it doesn't happen on a page but in a block instead. So that it can be placed on every page you want.