Email not sending V5 selfhosted in Plesk

Hi folks.
I have been having some issues with sending emails through V5, I can connect and send through Gmail which is fine… though when using email deliverability tools it gets flagged as spam because of a few reasons.

When connecting to my own mail server self-hosted through Plesk I am running into the same obstacle time and time again.

I have essentially copied my mail credentials into the env file

MAIL_DRIVER=smtp
MAIL_PORT=587
MAIL_ENCRYPTION=tls
MAIL_HOST=mail.URL.co.uk
MAIL_USERNAME="scott@URL.co.uk"
MAIL_FROM_ADDRESS="scott@URL.co.uk"
MAIL_FROM_NAME="Business Name"
MAIL_PASSWORD='something with special characters like ! and & and maybe a ^'

On Plesk my credentials are as follows:
### Manual setup

Mail server username
scott@URL.co.uk

Incoming mail server
URL.co.uk

Outgoing mail server
URL.co.uk
(server requires authentication)

Supported incoming mail protocols
POP3, POP3 over SSL/TLS, IMAP, IMAP over SSL/TLS
Supported outgoing mail protocols
SMTP
To connect via POP3 securely over SSL/TLS, use port 995.
To connect via IMAP securely over SSL/TLS, use port 993.
To send messages via SMTP securely, use port 465.

with the following option
Enable SMTP service on port 587 on all IP addresses enabled.

The error I keep getting is
"connection could not be established with host mail.URL.co.uk :stream_socket_client(): unable to connect to tcp://mail.URL.co.uk:587 (operation timed out)

Is there something that I am missing here at all?

Hi,

Are you sure the port is correct, you may want to run telnet mail.URL.co.uk 587 to check that it’s reachable.

Hi thanks for your response. Telnet from a remote source says that it can connect ok. Telnet from within the VM that contains Plesk and the container isn’t able to reach.

This then might be a DNS issue locally where it’s not getting resolved correctly?

It could be, you could try using the IP instead of the domain name to check

Ok, yes. doing telnet to the ip address works.
Having changed the env file to the following
MAIL_HOST=10.0.#.#

and putting " in the password as opposed to ’ is helping me move forward

New error message that comes from that is as follow:
*stream_socket_enable_crypto(): SSL operation failed with code 1. Open SSL Error message error:1416F086:SSL routine:tls_process_server_certificate:certificate verify failed

It looks like there’s a problem with the SSL certificate, sorry I can’t provide more help

No problem. I’m further forward than where I was. I appreciate your help.