Skip to main content
Setting up SMTP Mailing service Started by D.M. · · Read 10867 times 0 Members and 1 Guest are viewing this topic. previous topic - next topic

Setting up SMTP Mailing service

Hello there community ! Our forums I am currently working on is just about finished and ready to be open and running, but sadly I am hitting a wall when it comes to SMTP integration, namely I have chosen the SendGrid SMTP service which has a good enough free plan for a low monthly email load but it doesn't seem to be working. Everything is setup in the backend verified my domain at SendGrid, updated the DNS records on my backend even though I have tried all sorts of combinations in the ''SMTP Client'' , ''Proxy'' and ''STARTTLS'' fields I am stuck and not getting any emails through, should the STARTTLS even be checked when going through an SSL proxy and domain?, tried entering the non-ssl proxies which are given being two numbers separated by commas '','' but it gives me a strange error and deletes the mail queue. Maybe I should try another service provider or ? The only mails I have successfully sent were through PHP and those get fed into the spam folder as we all know, so theres no point in going for PHP

If anyone has any suggestions on what I may be doing wrong It would mean a lot ! Thanks in advance!

EDIT: Just to note that the problem is occurring definitely  at the ElkArte backend, I've got mail queue turned on just in case and when I click to send the mail queue it just refreshes the page and the time of the email but it doesnt let it go through

This is the error code from the error log:

eaea1ba6e0m2C0drhqPd9mzoFbJTNnsN
Type of error: General
Could not connect to SMTP host: 110 : Connection timed out

EDIT: I have since then been able to get through with the port 25, this is the new error I am getting (Keep in mind that I have tried every single domain / sender name combination including leaving it blank for the system to detect it, also verified both single sender and domain identities)

KqLWv938qwWMgz1g8YJOFtJ5Djqh4HTV
Type of error: General
Ran into problems sending Mail. Error: 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

EDIT: Currently waiting on new DNS changes to take effect
Last Edit: July 03, 2024, 06:48:09 am by Denis M.

Re: Setting up SMTP Mailing service

Reply #1

Quote from: Denis M. –
Type of error: General
Ran into problems sending Mail. Error: 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

EDIT: Currently waiting on new DNS changes to take effect

Typically, the server that hosts your forum (https://www.mydomain.com/myforum), also has a mailserver, so the simplest is to establish an email account on mydomain for your forum (myforum@mydomain.com). Most mail security protocols now require that the myforum@mydomain.com account only allows authentication from myforum@mydomain.com, not some other addy (such as "admin@mydomain.com"), trying to send through it.

Sendgrid has to pretend it's your server's mailserver, meaning you probably need to have domain authentication, and you need an individual account for each forum email address sending mail.  (I used to be able to have one primary sending account - master@mydomain.com- but now the from addy, and maybe the replyto addy? - has to match the account, not just log in as "master@mydomain.com, password: "pw1230hmy". The mailserver sets those rules and YMMV (your mileage may vary)..  

For sanity, you also need an individual account for each addy receiving email (not redirects to a common addy), if ElkArte needs to retrieve and direct them to a particular function (such as postbymail to particular forum categories).

Ports may also be important - my receiving ports need to use port 995, my sending ports need to use port 465. I also use Direct SSL, but not STARTTLS. But that is determined by my host's mailserver requirements.  Port 25, for example is basic old/school SMTP and has little security support, so few mailservers support port 25 any more..

I'd need to know a lot more about your forum configuration and sendgrid in order to be more specific, but the first thing I'd explore is whether your host has email account support for your forum - if so, that simplifies things greatly..
 
 

// Deep inside every dilemma lies a solution that involves explosives //

Re: Setting up SMTP Mailing service

Reply #2

I've only run SMTP on my localhost, and no I am not suggesting you run your own mailserver (unless you like great and lasting pain), I'm only indicating I'm a noob on this one.  Having only glanced at the sendgrid docs ....

SMTP Server looks like smtp.sendgrid.net should be entered
SMTP Client not sure, but normally this is the domain name of your site, like elkarte.net
SMTP Port looks like sendgrid uses 465
START TLS probably should be checked
Username  from your sendgrid credentials
Password again from your sendgrid credentials

ETA: Typed the above while @Steeley was giving you better information above
Last Edit: July 03, 2024, 11:47:10 am by Spuds

Re: Setting up SMTP Mailing service

Reply #3

Quote from: Steeley –
Quote from: Denis M. –
Type of error: General
Ran into problems sending Mail. Error: 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

EDIT: Currently waiting on new DNS changes to take effect

Typically, the server that hosts your forum (https://www.mydomain.com/myforum), also has a mailserver, so the simplest is to establish an email account on mydomain for your forum (myforum@mydomain.com). Most mail security protocols now require that the myforum@mydomain.com account only allows authentication from myforum@mydomain.com, not some other addy (such as "admin@mydomain.com"), trying to send through it.

Sendgrid has to pretend it's your server's mailserver, meaning you probably need to have domain authentication, and you need an individual account for each forum email address sending mail.  (I used to be able to have one primary sending account - master@mydomain.com- but now the from addy, and maybe the replyto addy? - has to match the account, not just log in as "master@mydomain.com, password: "pw1230hmy". The mailserver sets those rules and YMMV (your mileage may vary)..  

For sanity, you also need an individual account for each addy receiving email (not redirects to a common addy), if ElkArte needs to retrieve and direct them to a particular function (such as postbymail to particular forum categories).

Ports may also be important - my receiving ports need to use port 995, my sending ports need to use port 465. I also use Direct SSL, but not STARTTLS. But that is determined by my host's mailserver requirements.  Port 25, for example is basic old/school SMTP and has little security support, so few mailservers support port 25 any more..

I'd need to know a lot more about your forum configuration and sendgrid in order to be more specific, but the first thing I'd explore is whether your host has email account support for your forum - if so, that simplifies things greatly..
Quote from: Spuds – I've only run SMTP on my localhost, and no I am not suggesting you run your own mailserver (unless you like great and lasting pain), I'm only indicating I'm a noob on this one.  Having only glanced at the sendgrid docs ....

SMTP Server looks like smtp.sendgrid.net should be entered
SMTP Client not sure, but normally this is the domain name of your site, like elkarte.net
SMTP Port looks like sendgrid uses 465
START TLS probably should be checked
Username  from your sendgrid credentials
Password again from your sendgrid credentials

ETA: Typed the above while @Steeley was giving you better information above


Thanks gentlemen ! Although you are very informed and gave me a lot of useful information I will still be waiting a bit longer for the DNS records to update correctly (Though sendgrid Verify option has checked them and confirmed they are added)

While I wait here's some additional information about my current project / sendgrid details:

I am using a subdomain for the forums currently eg. forums.mydomain.cc
SendGrid verified my subdomain and gave me a new domain name that I thought was the correct client id eg. em111.forums.mydomain.cc
When I set up port 465 the error pops up: ''Could not connect to SMTP host: 110 : Connection timed out''
Only when using port 25 I get the: ''Type of error: General
Ran into problems sending Mail. Error: 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'' <- Even though I have tried every single combination regarding the client ID eg. forums.mydomain.cc , em111.forums.mydomain.cc , admin@forums.mydomain.cc , admin@mydomain.cc , when left blank the system fills it up with my hosting provider nameserver

I have verified the Sender Identification and passed the process as well as the domain verification, only thing that I could think of being wrong is the DNS records not updating yet eg. 48 hours, but i doubt it since SendGrid verified my domain and the updated records or may this be the cause ?

Thanks in advance any information helps !

EDIT: Also the question is should I verify my main domain on sendgrid as my domain or the actual forums.mydomain.cc subdomain I'm basically thinking of everything ATM and what could be the issue , currently verified forums.mydomain.cc and it's not working btw
Last Edit: July 03, 2024, 02:45:27 pm by Denis M.

Re: Setting up SMTP Mailing service

Reply #4

I tried to signup for a free account to help debug, but it was rejected for some reason LOL ... after it confirmed my email and 2FA to my phone.

Anyway looking at the help page

- Looks like the TLS port is on 587 and not the standard 465 ... so check TLS and use port 587
- Userid may need to be YXBpa2V5 which is a base64 version for the string  apikey
- Password appears to be your base64 encoded apikey ( you can use https://www.base64encode.org ) to encode your key

Really have no idea if that will work, just spit balling here

Re: Setting up SMTP Mailing service

Reply #5

Quote from: Spuds – I tried to signup for a free account to help debug, but it was rejected for some reason LOL ... after it confirmed my email and 2FA to my phone.

Anyway looking at the help page

- Looks like the TLS port is on 587 and not the standard 465 ... so check TLS and use port 587
- Userid may need to be YXBpa2V5 which is a base64 version for the string  apikey
- Password appears to be your base64 encoded apikey ( you can use https://www.base64encode.org ) to encode your key

Really have no idea if that will work, just spit balling here


Ah thanks for the info Spuds but that gives me a different error:
   0aspXWPuM8gCeWQH29SAedME8v9naYZD
Type of error: General
Ran into problems sending Mail. Error: 535 Authentication failed: Bad username / password

Seems like the only problem is the client ID / sender identity, still getting that error while on port 587 , although port 465 wont even go through , I've contacted my hosting support team for additional information waiting for them to reply by email since they took the holidays off on the livechat support


Re: Setting up SMTP Mailing service

Reply #6

So at least its connecting now .... continue to use 587 and TLS

Do you have other credentials you can enter? Try putting back what you had.

Re: Setting up SMTP Mailing service

Reply #7

Quote from: Spuds – So at least its connecting now .... continue to use 587 and TLS

Do you have other credentials you can enter? Try putting back what you had.


The credentials for Username and Password are:
Username: apikey
Password: (the api key)

Those work, but it seems that there's a problem with the ClientID field , I am not exactly sure which domain/email address should be entered, even though I tried all possible combinations supplied by SendGrid, I also got a reply from my hosting provider service staff that I should re-check DNS records and email validity gonna be doing that today since the 48h of DNS changes expires today, they also suggested I contact SendGrid support so I will be doing that also

Thanks for the brainstorming Spuds !

Re: Setting up SMTP Mailing service

Reply #8

Quote from: Spuds – SMTP Client not sure, but normally this is the domain name of your site, like elkarte.net
Agreed. By the way, it has explanation if one clicked the question mark to understand more.
Quote? A little lost? Let me explain:
Used to identify this client to the SMTP server.
The field should contain the fully-qualified domain name (FQDN) of the SMTP client. In situations in which the client system does not have a meaningful domain name you can instead use an address literal formatted as [ipv4] or [IPv6:ipv6 address].
If left blank the system will attempt to detect this value for you.
Hope that helps.

Re: Setting up SMTP Mailing service

Reply #9

Quote from: ahrasis –
Quote from: Spuds – SMTP Client not sure, but normally this is the domain name of your site, like elkarte.net
Agreed. By the way, it has explanation if one clicked the question mark to understand more.
Quote? A little lost? Let me explain:
Used to identify this client to the SMTP server.
The field should contain the fully-qualified domain name (FQDN) of the SMTP client. In situations in which the client system does not have a meaningful domain name you can instead use an address literal formatted as [ipv4] or [IPv6:ipv6 address].
If left blank the system will attempt to detect this value for you.
Hope that helps.


Greetings Ahrasis ! Yes that is correct information, and I have surely followed every single written guide on resolving the issue that pops up, but after contacting SendGrid support it seems that the problem still persists regarding their authentication system, I have already authenticated and verified my domain which causes email addresses to get authenticated automatically although the support staff told me that I still do not have a valid authenticated Email address which is capable of going through the mailing system, I am now currently in the process of fixing that issue with the help of SendGrid support and I will be sure to update this topic with the results and resolved issue !

Thanks for the efforts and the powerfull brainstorming gentlemen @ahrasis  @Spuds  @Steeley 

Re: Setting up SMTP Mailing service

Reply #10

Quote from: Denis M. – I will be sure to update this topic with the results and resolved issue !
Looking forward to the resolution, very curious  :smiley:

Re: Setting up SMTP Mailing service

Reply #11

Greetings to everyone ! I am happy to say that the issue has now been resolved finally ! After talking with SendGrid support for a couple of days we were finally able to verify the error after they looked into their backend error logs!

The issue was caused by verifying my subdomain which was a mistake ! After verifying my main domain instead of the subdomain the email finally went through !

My domain is now verified and capable to send SMTP mail!

Let this be a guide for future encounters people may have ! Be sure to verify your main domain since SendGrid services can not verify subdomains as a sender identity!

Cheers and good luck !  :partying_face  :partying_face

And thanks for the help gentlemen ! @ahrasis @Spuds @Steeley

 

Re: Setting up SMTP Mailing service

Reply #12

Thank you for letting us know that it is solved !! Glad its working.


Re: Setting up SMTP Mailing service

Reply #13

Quote from: Denis M. – main domain instead of the subdomain
We may get confused of this some times since both could be FQDN, so that is good to know.

Another question, did you also try to leave it blank instead of filling it and did that work?

Re: Setting up SMTP Mailing service

Reply #14

Quote from: Spuds – Thank you for letting us know that it is solved !! Glad its working.



Thanks for the efforts ! Support means a lot when having a hard time !

Quote from: ahrasis –
Quote from: Denis M. – main domain instead of the subdomain


We may get confused of this some times since both could be FQDN, so that is good to know.

Another question, did you also try to leave it blank instead of filling it and did that work?


The funny thing is that my ''SMTP Client'' field is actually setup wrong and it's still working ! I have my email address customaddress@forums.mydomain.cc in there but it still sends it through from the admin@forums.mydomain.cc email address so that's a bit funny if I understand correctly a domain name should be in there  :laugh:  but I guess I'll need to delete the admin@forums.mydomain.cc address from the SendGrid verified senders dashboard, but I'm currently too happy that it actually works and wont be touching anything so I don't ruin this happy feeling I got, well at least until I get a separate domain setup for the forums  :cheesy:

I actually just verified my main domain ''mydomain.cc'' in the SendGrid backend and it went through, didn't even notice the SMTP Client field was wrong, I'm not sure how this is working but as they say ''Do not question happiness'' :laugh: