John Mitchell wrote:
Also I forgot to mention below that this is on drupal 6.
On Thu, Mar 31, 2011 at 6:44 AM, John Mitchell mitchelljj98@gmail.comwrote:
Within a custom module I am trying to send the below so that an email is sent but I get the error *The submitted from address () is not valid.* This *from *email address does exist so why is it giving me this error?
You're missing the 'from' element in the message. But you shouldn't be using drupal_mail_send directly. You should use drupal_mail[1] and implement hook_mail[2] to add your subject and body to the message array.
$message = array(
'from' => 'support@domain123.com',
'to' => 'username1@domain123.com', 'subject' => t('Example subject'), 'body' => t('Example body'), 'headers' => array('From' => 'support@domain123.com'), ); drupal_mail_send($message);
[1] http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail/6 [2] http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_ma...