Reputation: 1
I have developed a yii2 application and deployed it in a CPanel on Bluehost. I created an email account in the CPanel to send emails using swiftmailer. When I use the email in localhost (my pc) it is working fine. however when I run it in CPanel it doesn't send the email even though the result is true and no error found in the logs. How can the hosted application send the emails? what configuration should be changed? I tried updating SPF records but it doesn't works. I checked the email restrictions and connect device details.
Sender domain for the project hosted in CPanel is a subdomain: api.mydomainname.com the domain is hosted on the same server.
email configuration is as follows:
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@common/mail',
'useFileTransport' => false,
// send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport
// for the mailer to send real emails.
'transport' => [
'class' => 'Swift_SmtpTransport',
//'host' => 'smtp.office365.com',
'host' => 'mail.mydomainname.com',
'port' => '587',
'username' => '[email protected]',
'password' => 'pass',
'encryption' => 'tls',
'streamOptions' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false,
],
]
],
]
I tried updating SPF records but it doesn't works. Changing the port to 25 & 465 and encryption to ssl. It fails to connect.
When I change the sender email([email protected]) and host (outlook.office365.com) it works fine.
Upvotes: 0
Views: 104
Reputation: 1
I Changed the host to mail.(main domain of my bluehost CPanel) and it worked
Upvotes: 0