Domanda

Ho provato ad usare php mailer ma errori come segue.

SMTP -> FROM SERVER:
SMTP -> FROM SERVER:
SMTP -> ERROR: EHLO not accepted from server:
SMTP -> FROM SERVER:
SMTP -> ERROR: HELO not accepted from server:
SMTP -> ERROR: AUTH not accepted from server:
SMTP -> NOTICE: EOF caught while checking if connectedSMTP Error: Could not authenticate. Message could not be sent.

Mailer Error: SMTP Error: Could not authenticate. 

e il mio codice

 <?php
        require("class.phpmailer.php")
        $mail = new PHPMailer();        
        $mail->IsSMTP();                                    
        $mail->Host = "smtp.gmail.com";  
        $mail->Port = 465;        
        $mail->SMTPAuth = true;     

        $mail->SMTPDebug = 2;  
        $mail->Username = "admin@xxxxxxxxxxxx.in";  
        $mail->Password = "xxxxxxxx";   
        $mail->From = "admin@xxxxxxxxxxxx.in";
        $mail->FromName = "Mailer";
        $mail->AddAddress("xxxx@yahoo.co.in", "mine");               
        $mail->WordWrap = 50;                                 
        $mail->IsHTML(true);                                  

        $mail->Subject = "Here is the subject"  
        $mail->Body    = "This is the HTML message body <b>in bold!</b>";
        $mail->AltBody = "This is the body in plain text for non-HTML mail clients";


        if(!$mail->Send())  {
           echo "Message could not be sent. <p>";
           echo "Mailer Error: " . $mail->ErrorInfo;
           exit;
        }
        echo "Message has been sent";

        ?>
È stato utile?

Soluzione

Alcuni server (in particolare hosting condiviso) si bloccherà di utilizzare SSL con SMTP, ho avuto lo stesso problema una volta.

In ogni cambiamento host se è possibile, provare a utilizzare la funzione predefinita di PHP mail () o inviare attraverso un altro server di posta che non richiede SSL per esempio porta 25 non 465.

AuthSMTP sarebbe la soluzione migliore per un server di posta alternativo.

Altri suggerimenti

mi è stato sempre presente a causa di porta sbagliata per SSL.

SSL = 465 TLS = 587

Vedi: http://mail.google.com/support/bin/answer.py?hl= it & answer = 13287

Ho avuto gli stessi problemi, sembra che abbiamo per impostare il valore SMPTSecure. In primo luogo ho cambiato il porto 465-587 e ha aggiunto:
$ Mail-> smtpsecure = "tls"; e ha funzionato:)

Se si sta lavorando nel vostro localhost basta andare alla PHP Extension e attivare o controllare la php_openssl sarà in grado di accedere alle porte SSL.

provare questo codice

require 'PHPMailerAutoload.php';

    //Create a new PHPMailer instance
    $mail = new PHPMailer();
    //Tell PHPMailer to use SMTP
    $mail->IsSMTP(); 
    //Enable SMTP debugging
    // 0 = off (for production use)
    // 1 = client messages
    // 2 = client and server messages
    //$mail->SMTPDebug = 2;

    //Ask for HTML-friendly debug output
    //$mail->Debugoutput = 'html';

    //Set the hostname of the mail server
    $mail->Host = 'smtp.gmail.com';

    //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
    $mail->Port = 465;

    //Set the encryption system to use - ssl (deprecated) or tls
    $mail->SMTPSecure = 'ssl';

    //Whether to use SMTP authentication
    $mail->SMTPAuth = true;

    //Username to use for SMTP authentication - use full email address for gmail
    $mail->Username = "admin@gmail.com";

    //Password to use for SMTP authentication
    $mail->Password = "admin123";

    $mail->setFrom('admin3@gmail.com', 'development');  //add sender email address.

    $mail->addAddress('admins@gmail.com', "development");  //Set who the message is to be sent to.
    //Set the subject line
    $mail->Subject = $response->subject;

    //Read an HTML message body from an external file, convert referenced images to embedded,
    //convert HTML into a basic plain-text alternative body
    $mail->Body     = 'Name: '.$data['name'].'<br />Location: '.$data['location'].'<br />Email: '.$data['email'].'<br />Phone:'.$data['phone'].'<br />ailment: '.$data['ailment'].'<br />symptoms: '.$data['symptoms'];

    //Replace the plain text body with one created manually
    $mail->AltBody = 'This is a plain-text message body';

    //Attach an image file
    //$mail->addAttachment('images/phpmailer_mini.gif');
    //$mail->SMTPAuth = true;
    //send the message, check for errors
    if (!$mail->send()) {
        echo "Mailer Error: " . $mail->ErrorInfo;
    } else {
        echo "Message sent!";
    }

Può essere a causa del muro di fuoco?

  

Se non è possibile accedere a Google Talk,   o si sta ricevendo un errore che   dice, non ha potuto eseguire l'autenticazione   del server, controllare se si dispone di personale   software firewall installato, o se   il computer è un server proxy   che richiede un nome utente e una password.

http://www.google.com /support/talk/bin/answer.py?hl=en&answer=30998

io uso lo stesso copione per diversi clienti e corro solo in questo problema durante la distribuzione di Amazon EC2 fornitori di cloud (come OpenShift).

Questi sono provati e testati in impostazioni phpmailer:     $ Mail-> smtpsecure = "tls"; // imposta il prefisso al servier     $ Mail-> Host = "smtp.gmail.com"; // imposta Gmail come server SMTP     $ Mail-> Port = 587;

'ma' Google blocchi tali servizi in qualità di 'antispam' manovra / politica, e questo mi ha colto in fallo perché funziona a livello locale e sulla maggior parte dei fornitori di hosting, non c'è molto che si può fare quando non accettano messaggi in uscita dal tuo host DNS / IP. Accettarlo e andare avanti con la ricerca di un altro server SMTP per instradare i messaggi attraverso.

Ha avuto lo stesso problema, modificare porto No in ambiente di posta OpenCart a 587 e funziona bene

Non sono sicuro, ma cercare $mail->Host = "smtp.gmail.com" =>$mail->Host = "smtp.google.com"

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top