[ACCEPTED]-PHP mailer error-phpmailer

Accepted answer
Score: 21

I was getting this due to wrong port for 1 SSL.

SSL = 465 TLS = 587

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

Score: 14

Some servers (especially shared hosting) will 7 block you from using SSL with SMTP, I had 6 the same problem once.

Either change host 5 if you can, try using the default PHP mail() function 4 or send through another mail server that 3 does not require SSL e.g. port 25 not 465.

Something 2 like AuthSMTP would be your best bet for an alternate 1 mail server.

Score: 9

I had the same problems, it seems that we 3 have to set the SMPTSecure value. First 2 I changed the port from 465 to 587 and added:
$mail->SMTPSecure 1 = "tls"; and it worked :)

Score: 5

If you are working in your localhost just 2 go to the PHP Extention and enable or check the php_openssl it will 1 be able to access the SSL ports.

Score: 3

try this code

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

0

Score: 3

Had the same issue, Change port No in opencart 1 mail setting to 587 and works fine

Score: 2

May be because of fire wall?

If you can't 6 sign in to Google Talk, or you're receiving 5 an error that says, Could not authenticate 4 to server, check if you have personal firewall 3 software installed, or if your computer 2 is behind a proxy server that requires 1 a username and password.

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

Score: 2

I use the same script for several clients 15 and only run into this problem when deploying 14 to Amazon EC2 cloud providers (such as Openshift).

These 13 are tried and tested settings in phpmailer: $mail->SMTPSecure 12 = "tls"; // sets the prefix 11 to the servier $mail->Host = "smtp.gmail.com"; // sets 10 GMAIL as the SMTP server $mail->Port 9 = 587;

'but' Google blocks these 8 services as an 'anti-spam' / political maneuver, and 7 this has caught me out because it works 6 locally and on most hosting providers, there 5 is nothing much you can do when they don't 4 accept outbound messages from your hosts 3 DNS / IP. Accept it and move on by looking 2 for another smtp server to route messages 1 through.

Score: 1

not sure but try $mail->Host = "smtp.gmail.com" =>$mail->Host = "smtp.google.com"

0

More Related questions