function simplenews_send_test in Simplenews 6
Same name and namespace in other branches
- 5 simplenews.module \simplenews_send_test()
- 6.2 includes/simplenews.mail.inc \simplenews_send_test()
- 7.2 includes/simplenews.mail.inc \simplenews_send_test()
- 7 includes/simplenews.mail.inc \simplenews_send_test()
Send test version of newsletter.
Parameters
integer or object $node Newsletter node to be sent. Integer = nid; Object = node object:
1 call to simplenews_send_test()
- simplenews_nodeapi in ./
simplenews.module - Implementation of hook_nodeapi().
File
- ./
simplenews.module, line 1456 - Simplnews node handling, sent email, newsletter block and general hooks
Code
function simplenews_send_test($node) {
if (is_numeric($node)) {
$node = node_load($node);
}
if (is_object($node)) {
// Send the test newsletter to the test address(es) specified in the node.
// Build array of test email addresses
$mails = explode(',', $node->simplenews['test_address']);
// Send newsletter to test addresses.
// Emails are send direct, not using the spool.
foreach ($mails as $mail) {
$mail = trim($mail);
if (!empty($mail)) {
$result = simplenews_mail_mail($node->nid, $node->vid, $mail, 'test');
}
}
if ($result) {
drupal_set_message(t('Test newsletter sent to %recipient.', array(
'%recipient' => $node->simplenews['test_address'],
)));
}
}
}