Page 1 of 1

A PHP maill function problem

Posted: Mon Feb 21, 2011 7:39 pm
by cearlp
Having a problem with mail() in PHP code.
The message is a warning and the mail gets sent but I am wondering what I must do to get rid of the warning message.

Here is the message:
warning: mail/var/log/mail.log [function.mail]: failed to open stream: Permission denied in code on line 21.

Here is the code. As you can see it comes from the CMS product drupal.
function drupal_mail_send($message) {
// Allow for a custom mail backend.
if (variable_get('smtp_library', '') && file_exists(variable_get('smtp_library', ''))) {
include_once './'. variable_get('smtp_library', '');
return drupal_mail_wrapper($message);
}
else {
$mimeheaders = array();
foreach ($message['headers'] as $name => $value) {
$mimeheaders[] = $name .': '. mime_header_encode($value);
}
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']),
// For headers, PHP's API suggests that we use CRLF normally,
// but some MTAs incorrecly replace LF with CRLF. See #234403.
join("\n", $mimeheaders)
); <----------------------- this is line 21
}
}

Other code using PHP mail on the same Ubuntu system works without error or warning messages.
And, sInce I get no response from drupal forums I thought I would try here.
Thanks in advance.