Skip to content

Instantly share code, notes, and snippets.

@chales
Created November 14, 2013 23:36
Show Gist options
  • Save chales/7476388 to your computer and use it in GitHub Desktop.
Save chales/7476388 to your computer and use it in GitHub Desktop.
Test Drupal email. Edit and add to the Drupal docroot to see if you can send a message. Note that this will not hook phpmailer or other libs that may be in use. Mainly for a quick proof of life type of check.
<?php
// Replace <user>@<host>, place in a drupal docroot, hit it with a browser.
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$message = array(
'id' => 'email_tester',
'to' => '<user>@<host>',
'subject' => t('Test subject'),
'body' => t('This is a test message to fill in the body.'),
'headers' => array('From' => '<user>@<host>'),
);
if (drupal_mail_send($message)) {
print 'Message sent';
} else {
print 'Message Failed';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment