Adding the 'from' element worked. I tried adding a 'cc' element and the email was sent but it did not send it to the 'cc' address. For now I will just include the 'cc' address within the 'from' element.
On Thu, Mar 31, 2011 at 8:27 AM, Earnie Boyd earnie@users.sourceforge.netwrote:
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.com wrote:
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...
-- Earnie -- http://progw.com
-- http://www.for-my-kids.com
[ Drupal support list | http://lists.drupal.org/ ]