PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, January 12, 2022

[FIXED] Extension YiiMaill (Swiftmailer) can't send SMTP from gmail

 January 12, 2022     email, php, swiftmailer, yii, yii-extensions     No comments   

Issue

I've a PHP application that's running with Yii Framework and it's using the YiiMail extension that's is based in Swiftmailer.

My application was working perfectly yesterday, but today the follow error was launched:

fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed

My Yii app config:

'mail' => 
  array('class' => 'application.extensions.yii-mail.YiiMail',
        'transportType' => 'smtp', 
        'transportOptions' => array(
             'host' => 'smtp.gmail.com', 
             'username' => '**@gmail.com', 
             'password' => '***', 
             'port' => '465', 
             'encryption'=>'tls' ), 
         'viewPath' => 'application.views.mail', 
         'logging' =>false, 
         'dryRun' => false
 )

ANSWER: A FAST SOLUTION

My app is running in Windows, so I did a fast configuration to solve this problem at moment.

I did a configuration with sendmail and it enable into my php.ini file.

Ps: The main problem is if you have many apps running in the same php. How don't this problem to me, it's is stand alone application, I just did.

Something like this:

sendmail.ini

[sendmail]
smtp_server=smtp.gmail.com
smtp_port = 587
#default_domain = gmail.com it's is not necessary
auth_username= your gmail@gmail.com
auth_password=your password

php.ini

[mail function]
sendmail_path = "path to sendmail installation"
SMTP = smtp.gmail.com
smtp_port = 587

Solution

If your current config was previously working, then suddenly stopped. Consider looking into the following:

  • Generating an APP password for a gmail account

  • Enabling Less SecureApps settings for your gmail account

I have encountered a similar problem before, enabling Less Secure Apps, then when I set 2 Step Verification for my google account, it stopped working.

Then generating an APP password, did the trick!



Answered By - Mark Ryan Orosa
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing