message could not be sent.mailer error: smtp connect() failed. https://github.com/phpmailer/phpmailer/wiki/troubleshooting

Hello Friends

When we use PHPmailer in Localhost sometime we Get Error(message could not be sent.mailer error: smtp connect() failed. https://github.com/phpmailer/phpmailer/wiki/troubleshooting) Specially if we are a gmail user So How we can over come with this type of errors

I will Suggest you to watch this video it will really help you


Step 1

require 'vendor\phpmailer\phpmailer\PHPMailerAutoload.php';
$mail = new PHPMailer;
//$mail->SMTPDebug = 3;                               // Enable verbose debug output
$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'smtp.mandrillapp.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'your@username.com';                 // SMTP username
$mail->Password = 'mandrilapp_will_give_you_a_password';                           // SMTP password
$mail->Port = 587;                                    // TCP port to connect to

After Editing the above code as per your requirement then run the php script in your localhost. The mail ID from which you are trying to send mail you will get a mail like this.
Then click on allowing access less secure apps and allow them

Step 2
Are you running on Localhost? and have you edit the php.ini ?

If not yet, try this:
1. Open xampp->php->php.ini
2. Search for extension=php_openssl.dll
3. The initial will look like this ;extension=php_openssl.dll
4. Remove the ';' and it will look like this extension=php_openssl.dll
5. If you can't find the extension=php_openssl.dll, add this line extension=php_openssl.dll.
6. Then restart your Xampp.

Goodluck ;)


Post a Comment

1 Comments

  1. Hi Clients!

    We have the fresh and valid USA ssn leads and dead fullz
    99% connectivity with quality
    *If you have any trust issue before any deal you may get few to test
    *Every leads are well checked and available 24 hours
    *Fully cooperate with clients

    *Format of Fullz/leads/profiles
    °First & last Name
    °SSN
    °DOB
    °(DRIVING LICENSE NUMBER)
    °ADDRESS
    (ZIP CODE,STATE,CITY)
    °PHONE NUMBER
    °EMAIL ADDRESS
    °REFERENCE DETAILS
    °BANK ACCOUNT DETAILS

    ****Contact Me****
    *ICQ :748957107
    *Telegram :@James307
    *Gmail :taimoorh944@gmail.com

    lead cost $2 for each
    Price can be negotiable if order in bulk

    *Contact soon!
    *Hope a long term deal
    *Thank You

    ReplyDelete