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

John Mitchell mitchelljj98 at gmail.com
Thu Mar 31 13:51:18 UTC 2011


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 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
>
> --
> Earnie
> -- http://progw.com
> -- http://www.for-my-kids.com
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>



-- 
John J. Mitchell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20110331/aa505f73/attachment.html 


More information about the support mailing list