SAlve a tutti, vorrei elencare 2 problemi... ho qst 2 funzioni nella pagina users.php per la gestione delll'invio email a gli iscritti su mio sito.. ora avrei necessita di 2 cose....
1. che l'email oltre che all'utente venga inviata sempre anche al mio indirizzo email in modo da averle archiviate...
mettendo
$to = $email;
$to = "mio indirizzo";
invia solo al mio indirizzo
2. ho un problema con i caratteri speciali.. ogni volta che scrivo nel form di testo me li cambia tutti come posos fare??
Codice PHP:
function SendEmail(){
include("header.php");
global $db, $prefix, $email, $username, $site_name, $site_email, $site_url;
nav_menu();
echo "<form method=\"POST\" action=\"users.php\">
<table align=\"center\" border=\"0\" width=\"500\" cellpadding=\"2\">
<tr>
<td colspan=\"2\" align=\"center\">Spedisci email a ($username)</td>
</tr>
<tr>
<td width=\"100\">To:</td>
<td><input type=\"text\" name=\"email\" size=\"27\" value=\"$email\"></td>
</tr>
<tr>
<td>Oggetto:</td>
<td><input type=\"text\" name=\"subject\" size=\"27\" value=\"\"></td>
</tr>
<tr>
<td valign=\"top\">Messaggio:</td>
<td>Salve $username,
<textarea rows=\"20\" name=\"msg\" cols=\"80\">Testoooo
</textarea>
---------------------
$site_name
$site_url
</td>
</tr>
<tr>
<td></td>
<td><input type=\"hidden\" name=\"action\" value=\"do_SendEmail\">
<input type=\"submit\" value=\"INVIA\"></td>
</tr>
</table>";
include("footer.php");
}
function do_SendEmail(){
global $email, $username, $subject, $msg, $site_name, $site_email, $site_url;
$message = "Salve $username,\n\n";
$message .= "$msg\n\n\n\n";
$message .= "-----------------------\n";
$message .= "$site_name\n";
$message .= "$site_url\n";
$to = $email;
$to = "mio indirizzo";
$header = "From: $site_name <$site_email>\n";
$header .= "Reply-To: $site_email\n\n";
if(mail($to, $subject, $message, $header)){
msg_redirect("".LOGIN." ".EFFETTUATO." ".CON." ".SUCCESSO."","users.php","5");
}else{
echo "<h3>"
."<font color=\"#FF0000\">An error occurred while sending the email.
"
."</font>You can try:
"
."1- Check the email is correct.
"
."2- Call your hosting provider to allow the function mail(); to send E-mails.
"
."3- If your running the script on localhost (on your pc) you have to:
"
."a: edit php.ini file. Click on (Start) menu then chose (Run) type in (php.ini) and hit Enter.
"
."b: Look for:
"
."------------------
"
."[mail function]
"
."; For Win32 only.
"
."SMTP = localhost
"
."-------------------
"
."replace with:
"
."-------------------
"
."[mail function]
"
."; For Win32 only.
"
."SMTP = mail.palnet.com
"
."SMTP_PORT = 25
"
."-------------------
"
."you can change mail.palnet.com to any local email provide. we just need there mail server";
}
}