Hi,
[This is a 6.x question but this should apply to prior versions by degree.]
I had a search/google for this question and should have been able to find it as a few hosts are insisting on the -f parameter for mail(. Sorry if I missed your answer, but could you point me at it please.
My host needs to see the "from" option used in Drupal before the mail.inc function "drupal_mail_send" is allowed to send mail.
From what I can see:
return mail(
$message['to'],
mime_header_encode($message['subject']),
// Note: e-mail uses CRLF for line-endings, but PHP's API requires LF.
// They will appear correctly in the actual e-mail that is sent.
str_replace("\r", '', $message['body']),
join("\n", $mimeheaders)
);
The fifth '-f' parameter 'from' isn't passed I think.
I would like to pick up the drupal e-mail address from the site config but my PHP programming isn't so good; my programming days were a while ago and on MS but I wouldn't mind getting back into it on OSS.
Where do I pick up that variable/function result in this module please? I tried to look for the function myself and didn't find it listed as a global variable.
Thanks in advance.
Comments
a little follow up..
I wasn't getting the mail that drupal sends out until I added:
"-fuser@domain.com"
before the final close bracket, but I'd like to add it without, Ugh, hard coding!!
This is becoming a habit..
--- mail.inc.orig 2008-01-25 17:04:00.000000000 +0000
+++ mail.inc.new 2008-04-05 20:35:52.991525652 +0100
@@ -181,13 +181,19 @@ function drupal_mail_send($message) {
foreach ($message['headers'] as $name => $value) {
$mimeheaders[] = $name .': '. mime_header_encode($value);
}
+
+ // added 5.4.08
+ // fasthosts needs -f parameter
+ $from = variable_get('site_mail', ini_get('sendmail_from'));
+
return mail(
$message['to'],
mime_header_encode($message['subject']),
// Note: e-mail uses CRLF for line-endings, but PHP's API requires LF.
// They will appear correctly in the actual e-mail that is sent.
str_replace("\r", '', $message['body']),
- join("\n", $mimeheaders)
+ join("\n", $mimeheaders),
+ "-f$from"
);
}
}
as I said I haven't ever coded in php before but I'm sure that $from can be put inline. Personally I can't see this every doing any harm so why can't it be put in the core source.
I found that the "default_from" variable in the top half of the mail include is blank so it wasn't helpful.
Fantastic these changes
Fantastic these changes immediately solved the Fasthosts problems we had.
Could someone explain this
Could someone explain this solution to me? I am new to drupal and php in general and am not sure how to implement this fix.
I have Drupal 6.13 and when users register, they never receive the confirmation email with initial password!
Bump.. please someone help!
Bump.. please someone help!
second bump!
we are having the same problem as above, could someone please help with instructions on the above fix for us php newbies?
Thanks for any light you can shed our way! :-)
This makes it work on
This makes it work on Fasthosts hosting setup.
Although you should not edit the core this is done to solve the issue on that hosting platform
The file you need to edit is drupal/install/mail.inc
you add the lines with a "+" and remove those with a "-"
the original code for the function looked like this
then would look like this..
At least I think that's what I did.
Welcome emails stopped
Welcome emails stopped working this morning.
see
http://drupal.org/node/316287
http://www.ubercart.org/forum/support/14578/emails_stopped_sending_cart
http://drupal.org/node/660084
http://drupal.org/node/466072
UPDATE: My email problem seems to be due to Comcast; they resolved it.