We're Hiring!

Mattermost, Inc.

Mattermost + Sendgrid = Dear God, What am I Doing Wrong?

After what feels like decades trying to get postfix to work on Mattermost install, I’ve given up and decided to try SendGrid as an SMTP email provider.

When I set the connection security to STARTLS I get the following error:

“Connection unsuccessful: Connection unsuccessful: failed to close connection to the SMTP server: 550 The from address does not match a verified Sender Identity. Mail cannot be sent until this error is resolved. Visit https://sendgrid.com/docs/for-developers/sending-email/sender-identity/ to see the Sender Identity requirements”

The following is in the log:

{"level":"error","ts":1624058759.579852,"caller":"mlog/log.go:251","msg":"Connection unsuccessful: failed to close connection to the SMTP server: 550 The from address does not match a verified Sender Identity. Mail cannot be sent until this error is resolved. Visit https://sendgrid.com/docs/for-developers/sending-email/sender-identity/ to see the Sender Identity requirements","path":"/api/v4/email/test","request_id":"43iipsg9tjrzdx357md8poejrw","ip_addr":"104.187.247.161","user_id":"hxwh3kazbff58p7ok46r5nx73y","method":"POST","err_where":"testEmail","http_code":500,"err_details":""}

When I set the security setting to TLS, I get the following error:

“Connection unsuccessful: Connection unsuccessful: unable to connect to the SMTP server through TLS: tls: first record does not look like a TLS handshake”

The following is in the log:

{"level":"error","ts":1624058873.0796726,"caller":"mlog/log.go:251","msg":"Connection unsuccessful: unable to connect to the SMTP server through TLS: tls: first record does not look like a TLS handshake","path":"/api/v4/email/test","request_id":"dhbow6di5tgctjsq7p1sz4jk1a","ip_addr":"104.187.247.161","user_id":"hxwh3kazbff58p7ok46r5nx73y","method":"POST","err_where":"testEmail","http_code":500,"err_details":""}

I’ve tried using both ports 25 and 587 - results are the same for both.

I’m also seeing the following in the log:

{"level":"warn","ts":1624058870.0358205,"caller":"api4/config.go:353","msg":"Unrecognized config permissions tag value.","tag_value":"sysconsole_write_*_read"}

I would appreciate any help anyone might be able to provide because I’m just about out of patience with email…like all of it.

Hello! I actually use SendGrid myself with my Mattermost Instance, so I can definitely help you with this one! This is actually a pretty quick fix as well.

The reason that you are getting this error is that the email address that your Mattermost server is trying to send the emails from (say, for example, mattermost@demo.com) does not match the email address that you have verified to send emails in your SendGrid account. (For example, the email address that you have verified through SendGrid is likely any other email address other than, in our example, mattermost@demo.com)

To fix this, you either need to change the email address that your Mattermost server sends the emails from to match the email address you have verified in SendGrid, or you need to create another verified email address in your SendGrid account, that is the same email address that Is currently configured to be the send address in your Mattermost server.

I hope that helps, and please let me know if you experience any further troubles!

1 Like

As a afterthought, I want to mention as well, that your server-side setup should not have anything to do with this error that you’re encountering - it is a purely SendGrid-side issue that needs to be resolved from your SendGrid account, or following the methods I outlined above.

1 Like

This is where you manage and add SendGrid verified senders:

turns out it wasn’t a sendgrid issue…it was a mattermost config issue. your send and reply to email address needs to be set to your sendgrid sender address. Somewhat counter intuitive as that content is the the notificaitons section of the system console, not the SMTP section. I ended up setting it in the config.json file as I didn’t discover where it was located in the system console until later.

1 Like

Ahh yes, that was one of the two methods that I described in my initial response - the emails just needed to match, yes. I’m glad you got it figured out!

1 Like

thanks much for taking the time, I really appreciate it.

1 Like

My pleasure, I’m glad you were able to resolve the problem!