Pergunta

Eu tentei usar mailer php mas os erros da seguinte forma.

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 meu código

 <?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";

        ?>
Foi útil?

Solução

Alguns servidores (especialmente hospedagem compartilhada) irão bloquear-lo de usar SSL com SMTP, eu tive o mesmo problema uma vez.

De qualquer mudança anfitrião se você puder, tente usar o email padrão PHP () ou enviar através de um outro servidor de correio que não exija SSL por exemplo porta 25 não 465.

Algo como AuthSMTP seria sua melhor aposta para um servidor de correio alternativo.

Outras dicas

Eu estava ficando este devido a porta errada para SSL.

SSL = 465 TLS = 587

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

Eu tive os mesmos problemas, parece que temos para definir o valor SMPTSecure. Primeiro eu mudei a porta 465-587 e acrescentou:
$ Mail-> SMTPSecure = "TLS"; e funcionou:)

Se você estiver trabalhando em sua localhost basta ir ao PHP Extensão e ativar ou verificar o php_openssl será capaz de acessar as portas SSL.

Tente este código

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!";
    }

Pode ser por causa da parede de fogo?

Se você não pode entrar no Google Talk, ou você está recebendo um erro que diz: Não foi possível autenticar servidor, verifique se você tem pessoal software de firewall instalado, ou se seu computador está atrás de um servidor proxy que requer um nome de usuário e senha.

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

Eu uso o mesmo script para diversos clientes e só executar para esse problema ao implantar a prestadores Amazon EC2 nuvem (como o OpenShift).

Estas são experimentadas e configurações testadas em phpmailer: $ Mail-> SMTPSecure = "TLS"; // define o prefixo para o servier $ Mail-> Host = "smtp.gmail.com"; // define o Gmail como o servidor SMTP $ Mail-> Port = 587;

'mas' Google bloqueia estes serviços como um 'anti-spam' / manobra política, e isso tem me pego de surpresa, porque ele funciona localmente e na maioria dos provedores de hospedagem, não há nada muito que você pode fazer quando eles não aceitam saída mensagens do seu anfitriões DNS / IP. Aceitá-lo e seguir em frente, procurando por outro servidor SMTP para encaminhar mensagens através de.

tive o mesmo problema, mudar a porta Não na definição de correio OpenCart para 587 e funciona bem

Não tenho certeza, mas tente $mail->Host = "smtp.gmail.com" =>$mail->Host = "smtp.google.com"

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top