Fatal error: Call to undefined function: mail()
- Codice: Seleziona tutto
<html>
<head>
</head>
<body>
<?php
//'''''''''' inserire il nome del dominio
$DOMAIN='...';
//'''''''''' inserire il nome della lista o delle liste
$LISTS[]='...';
$LISTS[]='altra_lista';
//''''''''fine configurazione
$response_template='
<br>
<center>
<div align="center">
<table border="0" cellspacing="1" cellpadding="2" width="570">
<tr>
<td align="center">
%%ACTION%% %%LIST%%@%%DOMAIN%%
</td>
</tr>
<tr>
<td class="response">
Riceverai una mail a breve su "%%ADDRESS%%".
Quello che devi fare è usare la funzione "Rispondi" del tuo client di posta
ed inviare tale risposta: non è necessario scrivere nulla.
</td>
</tr>
</table>
</div>
</center>
';
?>
<html>
<head>
<title>ISCRIZIONE ALLA MAILING LIST </title>
</head>
</body>
<center><div align="center"><br> <br>
<h6>Iscrizione alla mailing list ....@.....it</h6>
<table border="0" cellspacing="0" cellpadding="0" width="570">
<form method="post">
<tr>
<td align="center"><br><h6>Indirizzo email</h6></td>
<td align="center"><br><h6>Nome Lista / Azione</h6></td>
<td align="left"> </td>
</tr>
<tr>
<td align="center"><br><input type="text" value="<?php echo $_GET['a']; ?>" name="addy" size="30"></td>
<td align="center"><br><select name="list"><?php
if ( is_array($LISTS)) {
foreach ( $LISTS as $val ) {
echo '<option value="'.$val.'">'.$val.'@'.$DOMAIN.chr(10);
}
}
?></select><select name="action"><option value="subscribe">Iscriviti<option value="unsubscribe">Rimuovi iscrizione</select></td>
<td align="left"><br><input type="submit" value="Send"></td>
</tr>
</form>
</table>
</center></div>
<?php
switch ( $_POST['action'] ) {
case 'subscribe':
if ( !empty($_POST['addy']) ) {
if (mail($list.'-subscribe-'.str_replace('@', '=', $_POST['addy']).'@'.$DOMAIN ,'', '') ) {
show_tpl($response_template, 'ISCRITTO A: ', $list, $DOMAIN, $_POST['addy']);
}
}
break;
case 'unsubscribe':
if ( !empty($_POST['addy']) ) {
if (mail($list.'-unsubscribe-'.str_replace('@', '=', $_POST['addy']).'@'.$DOMAIN ,'', '') ) {
show_tpl($response_template, 'RIMOSSO DA: ', $list, $DOMAIN, $_POST['addy']);
}
}
break;
}
function show_tpl($tpl, $action, $list, $domain, $address) {
$tpl=str_replace('%%ACTION%%', $action, $tpl);
$tpl=str_replace('%%LIST%%', $list, $tpl);
$tpl=str_replace('%%DOMAIN%%', $domain, $tpl);
$tpl=str_replace('%%ADDRESS%%', $address, $tpl);
echo $tpl;
}
?>
</body>
</html>