Problem configuration sendgrid

Re: Problem configuration sendgrid

by Dustin Scott -
Number of replies: 10
Just in case you or someone else is having this issue, port 587 is not TLS encrypted with sendgrid, that would be port 465, so you would either need to change the port, or change the TLS setting.
Average of ratings: Useful (1)
In reply to Dustin Scott

Re: Problem configuration sendgrid

by Adam Malesevic -
I doubt that Dustin will see this message, so i wanted to ask everyone - what is the proper configuration for Sendgrid SMTP relay, because i'm struggling with this simple thing whole day already! Similar as Andy, I've tried also all possible combinations, but there's no way to make it to work! Here are my settings:

SMTP hosts:
smtp.sendgrid.net:465

SMTP security:
TLS

SMTP Auth Type:
LOGIN


SMTP username:
my_sendgrid_api_key_id


SMTP password:
••••••••••••••••••


SMTP session limit:
1
In reply to Adam Malesevic

Re: Problem configuration sendgrid

by Adam Malesevic -

Finally made it:


In reply to Adam Malesevic

Re: Problem configuration sendgrid

by Gabriel Ferrarese -

Hi Adam, What is the Sendgrid configuration you are using? 

On the moodle side I put the same as you and still keep getting error 504

This is my Api Key configuration



Average of ratings: Useful (1)
In reply to Gabriel Ferrarese

Re: Problem configuration sendgrid

by Adam Malesevic -
Hi Gabriel,
i've given a full access to my API key, but that is not the best solution honestly. I didn't try if it would work with restricted access (just Mail Send), as it should be set up, and as you have done.
Check if your Moodle server's IP is whitelisted on Sendgrid and also check if your firewall is open on email ports: 25, 465, 587, 993 etc..
If none of those help, try to install this plugin https://moodle.org/plugins/local_mailtest maybe it'll tell you something new..
Average of ratings: Useful (1)
In reply to Adam Malesevic

Re: Problem configuration sendgrid

by John Hood -

I was able to figure it out thanks to you pointing me in the right direction!

SMTP hosts: smtp.sendgrid.net:587
SMTP security: TLS
SMTP Auth Type: LOGIN
SMTP username: apikey
SMTP password: provided by SendGrid
SMTP session limit: 1

I left my SendGrid API Key Permissions on the default of Restricted Access and added my server's IP address to the SendGrid whitelist.

Edit: After looking back at the original question, it looks like my settings are the same as the original poster. I did set the No-reply address to something other than the Moodle default, not sure if that made a difference or not.

In reply to John Hood

Re: Problem configuration sendgrid

by Gavin Henrick -
Picture of Plugin developers

I got mine working with the following SendGrid config

SMTP hosts: smtp.sendgrid.net:465
SMTP security: SSL
SMTP Auth Type: LOGIN
SMTP username: apikey
SMTP password: provided by SendGrid
SMTP session limit: 1

Average of ratings: Useful (2)
In reply to Gavin Henrick

Re: Problem configuration sendgrid- STEP BY STEP

by Gerald Grow -

Here are the steps, for anyone confused about how how to change a Moodle using SendGrid for outgoing email, to one using SendGrid API -- as SendGrid is requiring you to do now (October 2020).

  • Sign in to your sendgrid.com account.
  • In the left column, click on Email API, then Integration Guide
  • In the page labeled "Integrate using our  web..." choose SMTP Relay
  • Click Create API Key, then SAVE IT! -- it will disappear after you read it.
  • Leave this page open, you will return to it in a minute. 
  • In another browser tab, log in to your Moodle, go to Site Administration/Server/Outgoing mail configuration
  • Set it up like this:

SMTP hosts: sendgrid.net:587
SMTP Security: TLS
SMTP Auth Type: LOGIN
SMTP username [yes, enter "apikey" as your username]: apikey
SMTP password: HERE ENTER THE API KEY YOU JUST GENERATED ON SENDGRID AND COPIED

  • At the bottom of the page, click Save Changes.
  • Return to SendGrid.com, check the box that you have updated your settings, then click "Next Verify Integration."
  • Follow the steps for verifying that this email setting works. 
  • Still on SendGrid.com, open your Account and set up two-factor authentication, which they now require. DO NOT DO THIS UNTIL AFTER YOU HAVE INSTALLED THE API KEY in your Moodle. Then sign out of SendGrid and verify that the two-factor authentication works. 

You might want to force Moodle to send another email, to be doubly sure the emails are working.

You can do this by going to the Moodle login and checking "Forgotten your password." That should send you an email from the Moodle you just updated. If you do not see this email, be sure to check your email client's Spam and Trash folders. 

I hope this includes everything, for those of us who are easily confused. wink



Average of ratings: Useful (3)
In reply to Gerald Grow

Re: Problem configuration sendgrid- STEP BY STEP

by romano gino -
Hello

I did everything and with several tests, this worked for me:
smtphosts smtp.sendgrid.net:465
seguridad SMPT SSL
SMTP Auth type LOGIN
Nombre de usuario apikey
Contraseña escribir la proveida por el servidor
Límite de sesión 1
In reply to Adam Malesevic

Re: Problem configuration sendgrid

by Eric Taylor -
Just to add some troubleshooting info onto this…

Be sure to check the Live Logs for the reason why your message failed!

In my case it was because I was sending from noreply@subdomain.domain.com. Once I changed it to noreply@domain.com (where domain is my actual domain name), everything suddenly started working perfectly.
Average of ratings: Useful (1)