Configure VestaCP/Exim to send email using SendGrid

EXIM CONFIGURATION
VestaCP replaces exim.conf with its own version that allows it to properly route emails for VestaCP accounts, so it’s important to be careful when editing. Best practice is to backup exim.conf file before editing it

CODE: SELECT ALL
cp /etc/exim/exim.conf /etc/exim/exim.conf-bkup

1. Open Exim Configuration

CODE: SELECT ALL
nano /etc/exim/exim.conf


2. You must configure Exim to Authenticate when sending email, or else you’ll end up with 550 Authentication errors.
FIND

CODE: SELECT ALL
host_lookup = *

ADD BELOW

CODE: SELECT ALL
auth_advertise_hosts = *


3. SendGrid Entries: Add the Credentials, Route and Transport to exim.conf
FIND

CODE: SELECT ALL
begin authenticators

ADD BELOW

CODE: SELECT ALL
sendgrid_login:
driver = plaintext
public_name = LOGIN
client_send = : sendgridusername : sendgridpassword

replace sendgridusername and sendgridpassword with your SendGrid login credentials.

FIND

CODE: SELECT ALL
begin routers

ADD BELOW

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

FIND

CODE: SELECT ALL
 begin transports

ADD BELOW

CODE: SELECT ALL
sendgrid_smtp:
driver = smtp
hosts = smtp.sendgrid.net
hosts_require_auth = smtp.sendgrid.net
hosts_require_tls = smtp.sendgrid.net


4. Save exim.conf and exit

5. Restart Exim

CODE: SELECT ALL
/etc/init.d/exim restart

You should now be able to successful send emails using the SendGrid service.

Leave a Comment

Your email address will not be published. Required fields are marked *

To Resolve this issue at just 5$ from ServerExpert

https://serverexpert.io/

For Hosting please visit Hostingwebsite.io

You have Successfully Subscribed!

Open chat