Errore e-mail
» EMAIL/PHP/mail()
Ho subito pensato che l'hosting avesse bloccato anche questa funzione ma mi hanno detto di no e infatti mi hanno dato una paginetta php di test che funziona (contiene questo codice):
Codice: Seleziona tutto
<?php
$txt = "Prima linea di testo\nSeconda linea di testo";
// Send email
mail("miamail@miamail.it","soggetto della email",$txt);
?>
Ho visto che la funzione mail() è gestita nel file includes/functions_messenger.php
con questo codice:
Codice: Seleziona tutto
/**
* Wrapper for sending out emails with the PHP's mail function
*/
function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg)
{
global $config, $phpbb_root_path, $phpEx;
// We use the EOL character for the OS here because the PHP mail function does not correctly transform line endings. On Windows SMTP is used (SMTP is \r\n), on UNIX a command is used...
// Reference: http://bugs.php.net/bug.php?id=15841
$headers = implode($eol, $headers);
if (!class_exists('phpbb_error_collector'))
{
include($phpbb_root_path . 'includes/error_collector.' . $phpEx);
}
$collector = new phpbb_error_collector;
$collector->install();
// On some PHP Versions mail() *may* fail if there are newlines within the subject.
// Newlines are used as a delimiter for lines in mail_encode() according to RFC 2045 section 6.8.
// Because PHP can't decide what is wanted we revert back to the non-RFC-compliant way of separating by one space (Use '' as parameter to mail_encode() results in SPACE used)
$result = $config['email_function_name']($to, mail_encode($subject, ''), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers);
$collector->uninstall();
$err_msg = $collector->format_errors();
return $result;
}
1-come posso visualizzare a schermo o nei logs in che modo viene tradotto il comando return $result;?
2-ho notato questo avviso nel codice:
// On some PHP Versions mail() *may* fail if there are newlines within the subject.
// Newlines are used as a delimiter for lines in mail_encode() according to RFC 2045 section 6.8.
// Because PHP can't decide what is wanted we revert back to the non-RFC-compliant way of separating by one space (Use '' as parameter to mail_encode() results in SPACE used)
come dovrei cambiare il codice per vedere se è quello il problema?