Condividi:        

php invio email

Problemi di HTML? Di PHP, ASP, .NET, JSP, Perl, SQL, JavaScript, Visual Basic..?
Vuoi realizzare programmi in C, C++, Java, Ruby o Smalltalk, e non sai da che parte cominciare?
Entra qui e troverai le risposte!

Moderatori: Anthony47, Triumph Of Steel, archimede

php invio email

Postdi alice1 » 09/05/06 14:30

Premetto che non sono molto esperta di PHP. Ho una mailing list su aruba e devo inserire un form d'iscrizione sul mio sito. Ho rispreso quello consigliato dal aruba, ma mi da questo problema
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 &quot;%%ADDRESS%%&quot;.
 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">&nbsp;</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>
alice1
Utente Junior
 
Post: 28
Iscritto il: 29/03/06 12:51

Sponsor
 

Postdi Triumph Of Steel » 09/05/06 17:33

dai un occhio qua
http://it2.php.net/manual/it/ref.mail.php

e chiedi conferma ad Aruba sulla configurazione riguardante il tuo account!
Avatar utente
Triumph Of Steel
Moderatore
 
Post: 7852
Iscritto il: 22/08/01 01:00


Torna a Programmazione


Topic correlati a "php invio email":

Password Imap (email)
Autore: lukarello7
Forum: Discussioni
Risposte: 8

Chi c’è in linea

Visitano il forum: Nessuno e 12 ospiti