By newgame on
warning: mail() has been disabled for security reasons in /home/.../includes/common.inc on line 1991.
in file common.inc online 1935 - 1993
function drupal_mail($mailkey, $to, $subject, $body, $from = NULL, $headers = array()) {
$defaults = array(
'MIME-Version' => '1.0',
'Content-Type' => 'text/plain; charset=UTF-8; format=flowed',
'Content-Transfer-Encoding' => '8Bit',
'X-Mailer' => 'Drupal'
);
// To prevent e-mail from looking like spam, the addresses in the Sender and
// Return-Path headers should have a domain authorized to use the originating
// SMTP server. Errors-To is redundant, but shouldn't hurt.
$default_from = variable_get('site_mail', ini_get('sendmail_from'));
if ($default_from) {
$defaults['From'] = $defaults['Reply-To'] = $defaults['Sender'] = $defaults['Return-Path'] = $defaults['Errors-To'] = $default_from;
}
if ($from) {
$defaults['From'] = $defaults['Reply-To'] = $from;
}
$headers = array_merge($defaults, $headers);
// Custom hook traversal to allow pass by reference
foreach (module_implements('mail_alter') AS $module) {
$function = $module .'_mail_alter';
$function($mailkey, $to, $subject, $body, $from, $headers);
}
// Allow for custom mail backend
if (variable_get('smtp_library', '') && file_exists(variable_get('smtp_library', ''))) {
include_once './' . variable_get('smtp_library', '');
return drupal_mail_wrapper($mailkey, $to, $subject, $body, $from, $headers);
}
else {
// Note: if you are having problems with sending mail, or mails look wrong
// when they are received you may have to modify the str_replace to suit
// your systems.
// - \r\n will work under dos and windows.
// - \n will work for linux, unix and BSDs.
// - \r will work for macs.
//
// According to RFC 2646, it's quite rude to not wrap your e-mails:
//
// "The Text/Plain media type is the lowest common denominator of
// Internet e-mail, with lines of no more than 997 characters (by
// convention usually no more than 80), and where the CRLF sequence
// represents a line break [MIME-IMT]."
//
// CRLF === \r\n
//
// http://www.rfc-editor.org/rfc/rfc2646.txt
$mimeheaders = array();
foreach ($headers as $name => $value) {
$mimeheaders[] = $name .': '. mime_header_encode($value);
}
return mail(
$to,
mime_header_encode($subject),
str_replace("\r", '', $body),
join("\n", $mimeheaders)
);
}
}
My host linux.
in PHP Configuration
Sub Section Directive Info Value
Language Options asp_tags Allow ASP-style <% %> tags. Off
File Uploads file_uploads Whether to allow HTTP file uploads. On
Paths and Directories include_path Windows: "\path1;\path2" .:/usr/lib/php:/usr/local/lib/php
Resource Limits max_execution_time 30
Resource Limits max_input_time 60
Resource Limits memory_limit 20M
Data Handling register_globals You should do your best to write your scripts so that they do not require register_globals to be on; Using form variables as globals can easily lead to possible security problems, if the code is not very well thought of. On
Language Options safe_mode Off
main session.save_path Argument passed to save_handler. In the case of files, this is the path where data files are stored. Note: Windows users have to change this variable in order to use PHP's session functions. As of PHP 4.0.1, you can define the path as: where N is an integer. Instead of storing all the session files in /path, what this will do is use subdirectories N-levels deep, and store the session data in those directories. This is useful if you or your OS have problems with lots of files in one directory, and is a more efficient layout for servers that handle lots of sessions. NOTE 1: PHP will not create this directory structure automatically. You can use the script in the ext/session dir for that purpose. NOTE 2: See the section on garbage collection below if you choose to use subdirectories for session storage /tmp
File Uploads upload_max_filesize Maximum allowed size for uploaded files. 8M
main zend_optimizer.version 3.3.0
Help me!
Thanks!
Comments
Your host has disabled the
Your host has disabled the PHP mail function. You must ask them to re-enable it for your account, or find a new web host.
- Corey
Really
Really?!, because my host:
But your host may still
But your host may still disable certain PHP function in your account. Look at your php info page. You can do it like this:
Look through the PHP configuration information. Specifically, look for a line that says, "disable_functions", and you will probably see "mail" listed there.
- Corey
Yes
Yes
:(
Thanks coreyp_1
The end;
the problem is not this
This is not the problem for me. The "disable_functions" is at "no value", therefore the function mail is not disabled.
What is the problem then?
Any ideas?