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.
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.
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.