gposse
(Gposse)
September 26, 2017, 3:40pm
1
Hi,
I’m getting the error message “class Swift_SmtpTransport does not exist” when trying to send an email. Using the same configuration in a local Windows environment works fine, but in production environment (Ubuntu linux) generates the error.
main-local component is configured this way:
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@common/mail',
'useFileTransport'=>false,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.sendgrid.net',
'username' => 'xxxx',
'password' => 'xxxx',
'port' => '587',
'encryption' => 'tls',
],
],
jacmoe
(Jacob Moen)
September 26, 2017, 3:52pm
2
It is really common, when moving from Windows to Linux, to run into case-sensivity errors.
First, check that ‘common/mail’ is indeed ‘common/mail’ and not ‘common/Mail’, etc.
gposse
(Gposse)
September 26, 2017, 4:01pm
3
jacmoe:
It is really common, when moving from Windows to Linux, to run into case-sensivity errors.
First, check that ‘common/mail’ is indeed ‘common/mail’ and not ‘common/Mail’, etc.
Thanks, but it’s correct. ‘common/mail’ does exists in both environments.
PHP 7 can make any difference? is there a specific package that should be installed?
Try this
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'ssl://smtp.sendgrid.net',
'username' => '',
'password' => '',
'port' => '465',
],
Or
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'tls://smtp.sendgrid.net',
'username' => '',
'password' => '',
'port' => '587',
],
KVron
(Lfparedes)
September 27, 2017, 12:05am
5
Do you have the following file in your system?
@vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailTransport.php
gposse
(Gposse)
September 28, 2017, 4:24am
7
It seems to be something really weird. I reinstalled the entire environment from scratch and it worked.