Can't send mails using smtp

We are trying to send mails using smtp. With these settings it’s working using server B settings, but not working using server A settings. Website is hosted on server A. What can be the reason?

Also tried to send mails with these settings in mail application, both are working.

'email' => [
	'transport' => [
	  'type' => 'smtp',
	  'host' => '',
	  'port' => 465,
	  'security' => 'ssl',
	  'auth' => true,
	  'username' => '',
	  'password' => 'hardtoguesspass',

Since this is marked as solved: What was the problem?

Sorry, I selected wrong category. It’s in Questions now.

It’s probably related to your hosting. I guess you are using different hosting companies for the two servers?

It’s same hosting company, but two different services. The one working - it’s shared hosting. And the one not working is dedicated server. But it has DirectAdmin, so I guess all necessary services are ready, as we didn’t have to do any additional server configuration, also we checked sending mails with Outlook - sending works. Also tried 587 port and TLS, or 'security' => true - didn’t help.

It’s probably some setting that prevent sending emails from the website. Maybe check out their docs or enquire with their support.

Have you tried looking at the maillogs on the dedicated box? Might tell you whats happening. Sending email between servers at the same hosting company can be tricky sometimes. Does it work if you send it to a gmail account or similar instead? Try sending to mail box that is not on you hosting at all.

The dedicated box might also have aggressive spam settings - some span filters delete imditaley so it might actually be working but its getting instantly deleted by the spam filter without notifying you. Again, see if you can find a log or something or poke around in DirectAdmin to see if you can turn notifications on.