[support] Within a custom module I am trying to send so that an email is sent but I get the error The submitted from address () is not valid.

Jason Flatt drupal at oadaeh.net
Thu Mar 31 14:24:54 UTC 2011


On Thu, 31 Mar 2011 09:51:18 -0400
John Mitchell <mitchelljj98 at gmail.com> wrote:

> 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.

Your Cc and Bcc fields go in your $header array.


> On Thu, Mar 31, 2011 at 8:27 AM, Earnie Boyd
> <earnie at users.sourceforge.net>wrote:
> 
> > 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 at 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 at domain123.com',
> > >>   'to' => 'username1 at domain123.com',
> > >>   'subject' => t('Example subject'),
> > >>   'body' => t('Example body'),
> > >>   'headers' => array('From' => 'support at 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_mail/6
> >


-- 
Jason Flatt
Custom Website development solutions: http://www.oadaeh.net/
Father of seven: http://www.flattfamily.com/ (Joseph, 18; Cramer, 16; Travis,
14; Angela; Harry, 10; William, 5; and Dolly, 2) Linux user:
http://www.ubuntu.org/ Android user: http://www.android.com/
Drupal fanatic: http://drupal.org/


More information about the support mailing list