Quindi, da ucp.php?mode=register e in particolare nel template ucp_agreement.html ho inserito un form per mandarmi la mail.
L'azione del form è verso una pagina creata da me, chiamata send.php e posta nella root del forum; con il seguente codice:
Codice: Seleziona tutto
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
$user->session_begin();
$auth->acl($user->data);
$user->setup();
$email_to="info@digreo.it"; // Indirizzo del destinatario
$words="Messaggio inviato da DIGREO.it"; // Parole aggiuntive da inserire nell'email
$name=$_POST['name'];
$surname=$_POST['surname'];
$city=$_POST['city'];
$occupatio=$_POST['occupatio'];
$emails=$_POST['emails'];
$request=$_POST['request'];
function res_req(){
if(($name == "")|($surname == "")|($city=="")|($request=="")|($occupatio=="")){
echo "<center>".$user->lang['WRONG_REQ']."</center><br />";
echo "<center><b><a href='javascript:history.back();'>".$user->lang['BACK']."</a></b></center>";
}
elseif(($emails!="")&!(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)",$emails))){
echo "<center>".$user->lang['WRONG_EMAIL']."</center><br />";
echo "<center><b><a href='javascript:history.back();'>".$user->lang['BACK']."</a></b></center>";
}
else{
if(!(empty($emails))) $from="From: $emails\r\nReply-to: $emails\r\n";
else{
$emails="empty@emails.empty";
$from="From: $emails\r\nReply-to: $emails\r\n";
}
$message=$words."\n\n";
$message.= "".$user->lang['NAME'].": ".$name."\n";
$message.="".$user->lang['SURNAME'].": ".$surname."\n";
$message.="".$user->lang['CITY'].": ".$city."\n";
$message.="".$user->lang['OCCUPATIO'].": ".$occupatio."\n";
$message.="".$user->lang['USERNAME'].": ".$request;
$message=stripslashes($message);
mail($email_to,$message,$from);
echo "<center>".$user->lang['POST']." ".$user->lang['POSTED']."!<br />".$user->lang['REQ_STAY']."</center>";
}
}
$template->assign_var('REQUEST_RES', res_req());
page_header($user->lang['SEND_REQ']);
$template->set_filenames(array(
'body' => 'sendreq.html')
);
page_footer();
?>
Il problema è che non manda alcuna mail e sul template non si vede stampato niente!
Dov'è il problema? Come potrei realizzare meglio questa funzione?
Grazie infinite!