Languages

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.

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));

Drupal 7.x:

$my_module = 'no_module';
$my_mail_token = 'no_token';
$from = variable_get('site_mail', ini_get('sendmail_from'));
$message = array(
  'id' => $my_module . '_' . $my_mail_token,
  'to' => 'email@example.com',
  'subject' => 'test',
  'body' => 'test',
  'headers' => array(
    'From' => $from, 
    'Sender' => $from, 
    'Return-Path' => $from,
  ),
);
$system = drupal_mail_system('no_module', $my_mail_token);
if ($system->mail($message)) {
  dpm('ok');
}
else {
  dpm('error');
}
Posted by ariel on April 18th, 2011
Comments: 4

Сварная двутавровая балка

Сварная двутавровая балка Балки сварные двутавровые 10-60см в наличии. 4 склада в Москве. Доставка Новинский ЗМК

cassandra xxx hawaii vice

cassandra xxx hawaii vice 7
RetroPornArchive is just what the name says - a large collection of all kinds of ancient smut, including photos and videos. Gigs of handpicked content that might even feature your grandparents!

vintage lesbian porn free three retro lesbians
candy samples pics sex vintage

Cindy Taylor

WATCH VINTAGE PORN HERE FOR FREE >>> http://classicpornomovies.mobi/
Kostas Doukas
Don Watson

cassandra xxx hawaii vice

cassandra xxx hawaii vice 7
RetroPornArchive is just what the name says - a large collection of all kinds of ancient smut, including photos and videos. Gigs of handpicked content that might even feature your grandparents!

vintage lesbian porn free three retro lesbians
candy samples pics sex vintage

Cindy Taylor

WATCH VINTAGE PORN HERE FOR FREE >>> http://classicpornomovies.mobi/
Kostas Doukas
Don Watson

I don't care about this, now

I don't care about this, now i'm earning average 5000$ a month. There is tricky way i found on the web. If you want to learn it too, just type in google: Hatvesu's Earning Online Strategy

Post new comment

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