0

I have developed a separate functionality using PHP in a sub folder of my Drupal site (e.g. mysite.com/myfolder/myfunc.php).

Now I want to send emails using Drupal functions. Since this is not a custom module I can't use hook_mail().

How do I send an email through Drupal?

0

Try like this:

$to = 'ABCD@example.com'; 
$subject = 'Email in PHP'; 
$message = 'This is a test email message';
$headers = 'From: ABCD@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); 
mail($to, $subject, $message, $headers, 'ABCD@example.com'); 
  • I wanted in drupal way, but in Core PHP. I did that i will post the answer after modification. – siddiq Oct 10 '17 at 3:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.