Please help, novice drupaller here,
Here is the scenario of what I am going to do ,

I have a custom module using which i can collect the user entered data including email id.
What should be done, so that I will be able to send the conformation email to that user entered email id by any user.
And user should be able to verify it.

Any help is appreciated.
Thank you.


Usha Gavva’s picture

Try using drupal_mail() function, refer the below link.

anilshrish’s picture

Thanks usha g .

could you please help by providing simple code snippet for my scenario.

subhransu’s picture

Better you should use hook_mail()

You can find the example code at!system!system.api.php/function/hook_mail/7

Usha Gavva’s picture

Here is the code snippet,

        $module = 'module_name';
        $key = 'Confirmation mail';
	$to = 'to address';
	$language = language_default();
	$params = array();
	$params['subject'] ="Confirmation mail";
	$params['body'] = "<p>Your message here...</p>"; 
        $from = 'from address';
	$send = TRUE;
	$result = drupal_mail($module, $key, $to, $language, $params, $from, $send);
        if ($result['result'] == TRUE) {
             drupal_set_message(t('Your message has been sent.'));
        } else {
            drupal_set_message(t('There was a problem sending your message and it was not sent.'), 'error');