Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    send_smtp.php da *** ???

    Ciao a tutti,
    vorrei costruire una procedura per inviare una newlsetter ed ho chiesto al provider (***) dove risiede il mio dominio, come poter fare. Mi hanno inviato un file send_smtp.php secondo cui è possibile l'invio di un alto numero di mails tramite l'apertura di una connessione al server SMTP. Esso può essere modificato in modo da non inviare le emails tutte ad un unico destinatario, ma ad una lista presente, ad esempio, in un file di testo o in una tabella all'interno di un database MySQL.
    Io sinceramente non conosco benissimo il php (sono all'inizio) e quindi non capisco come posso utilizzarlo. Qualcuno può aiutarmi ???? Vi posto il codice:

    <?php
    /* * * * * * * * * * * * * * SEND EMAIL FUNCTIONS * * * * * * * * * * * * * */

    //Authenticate Send - 21st March 2005
    //This will send an email using auth smtp and output a log array
    //logArray - connection,

    function authSendEmail($from, $namefrom, $to, $nameto, $subject, $message)
    {

    //SMTP + SERVER DETAILS
    /* * * * CONFIGURATION START * * * */
    $smtpServer = "smtp.miodominio.com"; //indirizzo smtp da utilizzare
    $port = "25";
    $timeout = "30";
    $username = ""; //username di accesso
    $password = ""; //password di accesso
    $localhost = "localhost";
    $newLine = "\r\n";
    $totale = ""; //numero di email da inviare

    /* * * * CONFIGURATION END * * * * */

    //Connect to the host on the specified port
    $smtpConnect = fsockopen($smtpServer, $port, $errno, $errstr, $timeout);
    $smtpResponse = fgets($smtpConnect, 515);
    if(empty($smtpConnect))
    {
    $output = "Failed to connect: $smtpResponse";
    return $output;
    }
    else
    {
    $logArray['connection'] = "Connected: $smtpResponse";
    }

    //Request Auth Login
    fputs($smtpConnect,"AUTH LOGIN" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['authrequest'] = "$smtpResponse";

    //Send username
    fputs($smtpConnect, base64_encode($username) . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['authusername'] = "$smtpResponse";

    //Send password
    fputs($smtpConnect, base64_encode($password) . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['authpassword'] = "$smtpResponse";

    //Say Hello to SMTP
    fputs($smtpConnect, "HELO $localhost" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['heloresponse'] = "$smtpResponse";


    for($i=0;$i<=$totale;$i++) {
    //Email From
    fputs($smtpConnect, "MAIL FROM: $from" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['mailfromresponse'] = "$smtpResponse";

    //Email To
    fputs($smtpConnect, "RCPT TO: $to" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['mailtoresponse'] = "$smtpResponse";

    //The Email
    fputs($smtpConnect, "DATA" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['data1response'] = "$smtpResponse";

    //Construct Headers
    $headers = "MIME-Version: 1.0" . $newLine;
    $headers .= "Content-type: text/html; charset=iso-8859-1" . $newLine;
    $headers .= "To: $nameto <$to>" . $newLine;
    $headers .= "From: $namefrom <$from>" . $newLine;

    fputs($smtpConnect, "To: $to\nFrom: $from\nSubject: $subject\n$headers\n\n$message\n.\n");
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['data2response'] = "$smtpResponse";
    }
    // Say Bye to SMTP
    fputs($smtpConnect,"QUIT" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['quitresponse'] = "$smtpResponse";
    }


    $from = ""; //indirizzo mail mittente
    $namefrom = ""; //nome da visualizzare del mittente
    $to = ""; //indirizzo mail destinatario
    $nameto = ""; //nome visualizzato del destinatario
    $subject = ""; //oggetto dell'email
    $message = ""; //tsto del messaggio
    authSendEmail($from, $namefrom, $to, $nameto, $subject, $message);

    ?>

    Ciao e grazie in anticipo...
    http://www.sibiweb.it

  2. #2

    ... qualcuno che conosca il php c'è???

    ... qualcuno che conosca il php c'è???
    Non riesco a sfruttare il codice sopra descritto...
    Aiuto !!!!!!
    http://www.sibiweb.it

  3. #3
    Utente di HTML.it L'avatar di Luke70
    Registrato dal
    Jul 1999
    Messaggi
    767
    Un forum come questo non è un posto dove uno arriva e dice "vorrei fare questo e quest'altro, ma non ci capisco nulla fatelo voi per me".
    E' un forum dove si cerca di darsi una mano tra persone che almeno "ci provano".

    Se non sai da che parte cominciare utilizza uno script già pronto per l'invio di newsletter.
    Partire dallo script che ti hanno dato e modificarlo per un "alto numero di mails" (come scrivi tu) non è così rapido da essere fatto gratis et amore dei da qualcuno del forum.

  4. #4
    Utente di HTML.it L'avatar di nicola75ss
    Registrato dal
    Nov 2004
    Messaggi
    12,923
    Come specificato nel regolamento è vietato fare nomi di servizi di hosting a pagamento. Se vuoi riapri la discussione attenendoti alle norme.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.