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.
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? Thanks, John $message = array( 'to' => 'username1@domain123.com', 'subject' => t('Example subject'), 'body' => t('Example body'), 'headers' => array('From' => 'support@domain123.com'), ); drupal_mail_send($message); -- John J. Mitchell
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?
Thanks,
John
$message = array( 'to' => 'username1@domain123.com', 'subject' => t('Example subject'), 'body' => t('Example body'), 'headers' => array('From' => 'support@domain123.com'), ); drupal_mail_send($message);
-- John J. Mitchell
-- John J. Mitchell
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
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.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@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/ ]
-- John J. Mitchell
I meant to say *I will just include the 'cc' address within the 'to' element.* On Thu, Mar 31, 2011 at 9:51 AM, John Mitchell <mitchelljj98@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.
On Thu, Mar 31, 2011 at 8:27 AM, Earnie Boyd <earnie@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@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/ ]
-- John J. Mitchell
-- John J. Mitchell
On Thu, 31 Mar 2011 09:51:18 -0400 John Mitchell <mitchelljj98@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@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@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...
-- 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/
Within a custom module I am trying to send an email but it goes into the
spam folder when the email is to a gmail email address.
I am using drupal_mail[1] and then I implement hook_mail[2] to add the subject, headers and body to the message array. The header is a Content-Type of text/html (see below), but if I don't include the headers in the message array then it does not go in the spam folder but then I can't use any html tags within the email body.
John
[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...
$headers = array(
'MIME-Version' => '1.0',
'Content-Type' => 'text/html; charset=iso-8859-1',
'Content-Transfer-Encoding' => '8Bit',
'X-Mailer' => 'Drupal',
);
-- John J. Mitchell
This according to me should not give error, Try giving a valid email id and then see what happens On Thu, Mar 31, 2011 at 4:14 PM, 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?
Thanks,
John
$message = array( 'to' => 'username1@domain123.com', 'subject' => t('Example subject'), 'body' => t('Example body'), 'headers' => array('From' => 'support@domain123.com'), ); drupal_mail_send($message);
-- John J. Mitchell
-- [ Drupal support list | http://lists.drupal.org/ ]
-- Regards, Vaibhav Jain
I did give a valid email id. The example below just does not show it but within the actually module I do have a valid email address. John On Thu, Mar 31, 2011 at 6:55 AM, Vaibhav Jain <in.vaibhavjain@gmail.com>wrote:
This according to me should not give error, Try giving a valid email id and then see what happens
On Thu, Mar 31, 2011 at 4:14 PM, 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?
Thanks,
John
$message = array( 'to' => 'username1@domain123.com', 'subject' => t('Example subject'), 'body' => t('Example body'), 'headers' => array('From' => 'support@domain123.com'), ); drupal_mail_send($message);
-- John J. Mitchell
-- [ Drupal support list | http://lists.drupal.org/ ]
-- Regards, Vaibhav Jain
-- [ Drupal support list | http://lists.drupal.org/ ]
-- John J. Mitchell
participants (4)
-
Earnie Boyd -
Jason Flatt -
John Mitchell -
Vaibhav Jain