Enquiries: info@infomagnet.com / +44 (0)20 7193 3323

Testing drupal_mail() from a PHP block

Sometimes it's useful to test the sending of an email to a specific address w/o configuring/installing any module to do such thing. For that I personally use a PHP snippet that can be executed from the PHP block that comes from the devel module.

The snippet is the following for drupal 6.x:

$to = 'email@example.com';
 
$message = drupal_mail('no_module', 'key_not_used', $to, language_default(), array(), null, FALSE);
$message['subject'] = 'Test message';
$message['body'] = 'This is a test message';
// Send e-mail.
dvm(drupal_mail_send($message));

Posted by ariel on April 18th, 2011
Comments: 0

Post new comment

The content of this field is kept private and will not be shown publicly.