How to Setup SendGrid as email relay in CloudStick server

Setting up Sendgrid as an email relay on your needs backend integration at this moment. You need to login into the server as root over SSH and follow the steps below:

 

First of all, you need to backup the file /etc/exim4/exim4.conf.template to get this done, use the command below:

 

cp /etc/exim4/exim4.conf.template /etc/exim4/exim4.conf.template-back

 

vi /etc/exim4/exim4.conf.template

 

Under ‘begin authenticators’ Please add the following lines:

 

sendgrid_login:
driver = plaintext
public_name = LOGIN
client_send = : apikey : key
 
Note: username should actually be ‘apikey’, not your sendgrid username

 

 
Under ‘begin routers’ Please add the following lines:

 

send_via_sendgrid:
driver = manualroute
domains = ! +local_domains
transport = sendgrid_smtp
route_list = "* smtp.sendgrid.net::587 byname"
host_find_failed = defer
no_more

 
Under ‘begin transports’ Please add the following lines:

 

sendgrid_smtp:
driver = smtp
hosts = smtp.sendgrid.net
hosts_require_tls = <; $host_address

 
Under router configuration for alias and catchall I need to be changed as follows:

 

redirect_router = dnslookup
To
redirect_router = send_via_sendgrid