/
mail.php
70 lines (70 loc) · 2.08 KB
/
mail.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
include_once("lib/class.php");
include_once("lib/db_mysql.php");
makeHead("Invio Email Al Capogita");
if( is_numeric($_POST['toid']))
{
$database = new db_local();
$database->query("SELECT * FROM anagrafiche WHERE id = '".$_POST['toid']."' LIMIT 1;",true);
if($database->next_record())
{
if(mail($database->record['email'], $_POST['oggetto'], $_POST['messaggio'],
"From: ".$_POST['nome']." <".$_POST['da'].">\r\n" .
"Reply-To: ".$_POST['da']."\r\n" .
"X-Mailer: Mailer/Bici&Dintorni"))
echo "<div align=\"center\">Il messaggio è stato inviato correttamente.</div>";
else
echo "<div align=\"center\">Errore nell'invio del messaggio.(Segnalare il problema al webmaster (Error: mail false)</div>";
}
else
echo "<div align=\"center\">Errore nell'invio del messaggio.(Segnalare il problema al webmaster (Error: nessun utente a cui inviare il messaggio)</div>";
makeTail();
exit;
}
if( is_numeric($_GET['id']))
{
$database = new db_local();
$database->query("SELECT * FROM anagrafiche WHERE id = '".$_GET['id']."' LIMIT 1;",true);
if(!$database->next_record())
{
echo "Errore sconosciuto";
makeTail();
return;
}
?>
<form action="mail.php" method="post" name="emailForm">
<table align="center">
<tr>
<td colspan="2">Manda una e-mail a questo contatto:<br><br></td>
</tr>
<tr>
<td>Il tuo nome:</td>
<td><input size="50" name="nome" value="<?php echo $user->nome." ".$user->cognome;?>"></td>
</tr>
<tr>
<td>Inserisci il tuo indirizzo e-mail:</td>
<td><input size="50" name="da" value="<?php echo $user->email;?>"></td>
</tr>
<tr>
<td>A:</td>
<td><?php echo $database->record['nome']." ".$database->record['cognome']; ?></td>
</tr>
<tr>
<td>Oggetto del messaggio:</td>
<td><input size="50" name="oggetto"></td>
</tr>
<tr>
<td>Inserisci il tuo messaggio:</td>
<td><textarea cols="50" name="messaggio"></textarea></td>
</tr>
<tr>
<td> </td>
<td align="right"><button type="submit">Invia</button><input name="toid" type="hidden" value="<?php echo $_GET['id'];?>"></td>
</tr>
</table>
</form>
<?php
}
makeTail();
exit;
?>