TLS Negotiation failed: FAILED_PRECONDITION: starttls error (0): protocol error
Hi,
I have set the routing endpoint to gsuite email address for the sending email address(as there is no physical mailbox exists for the sender email address) so that whenever a person replies to the email it should be sent to the routing endpoint email address.
The problem I'm facing is whenever i send emails from any gmail or gsuite emaill address these emails are not delivering to an endpoint email address and giving this error message "TLS Negotiation failed: FAILED_PRECONDITION: starttls error (0): protocol error ".
However they are delivering fine from outlook, zoho and other email clients.
I also do not see emails sent from gmail as incoming messages in dashboard, it seems to me that messages sent from gmail/gsuite are not reaching to Postal.
Any help would be highly appreciated.
Thanks.
Where are you seeing that error message?
It came to my gmail account from where i'm sending email.
can you share a screenshot?
@willpower232 Here is the screenshot

It might be that you haven't set up Postals SMTP to use a real certificate and gmail is the only provider that is strict in this regard which is good to know.
Have you configured these settings in your postal.yml? https://github.com/postalhq/postal/blob/2595481b266199d8e29347dea2764f2c10202805/config/postal.defaults.yml#L75-L77
@willpower232 I have set up the Let's Encrypt free SSL certificate for nginx and Postal, this is how Postal configuration looks.
smtp:
# Specify an SMTP server that can be used to send messages from the Postal management
# system to users. You can configure this to use a Postal mail server once the
# your installation has been set up.
host: 127.0.0.1
port: 25
username: # Complete when Postal is running and you can
password: # generate the credentials within the interface.
from_name: Postal
from_address: [email protected]
smtp_server:
tls_enabled: true
tls_certificate_path: /etc/letsencrypt/live/mail.mydomain.com/fullchain.pem
tls_private_key_path: /etc/letsencrypt/live/mail.mydomain.com/privkey.pem
@willpower232 When i disable/remove these lines, it works fine but how we can get it work with the letsencrypt real SSL.
smtp_server:
tls_enabled: true
tls_certificate_path: /etc/letsencrypt/live/mail.mydomain.com/fullchain.pem
tls_private_key_path: /etc/letsencrypt/live/mail.mydomain.com/privkey.pem
Out of curiousity, do you have any firewalls or proxying present?
No, there is no firewall or proxy present on my server.
You could try using this command to verify how well Postal is using SSL openssl s_client -connect your.postal.server.ip:25 -starttls smtp, I'm not really qualified to understand the output but if that command errors or does not talk about Lets Encrypt then you might have a clue what is wrong.
When I changed the certificate path to a self-signed certificate the output of this command shows the result saying it's using a self-signed certificate, but in same location (/opt/postal/config/) I only see lets_encrypt.pem file which I'm not sure if it's a cert file or key file, I have used the same file for both tls_certificate_path and tls_private_key_path but it's giving me an error message.
smtp_server:
tls_enabled: true
tls_certificate_path: /opt/postal/config/fast_server.cert
tls_private_key_path: /opt/postal/config/fast_server.key

When I use the following SSL location it does not give any error message, it says no SSL has been configured or found.
tls_enabled: true
tls_certificate_path: /etc/letsencrypt/live/mail.mydomain.com/fullchain.pem
tls_private_key_path: /etc/letsencrypt/live/mail.mydomain.com/privkey.pem
Hope this information will help!
Thank you s much for the help so far 👍
That implies that Postal is unable to access the files or that file path is not correct. You might have to change the permissions on the folders to allow Postal to read the files.
It worked! Thank you so much for the great support!
no problemo, feel free to close the issue if you have no more queries