We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on Vesta 2.0 and expect to release it by the end of 2024. Read more about it: https://vestacp.com/docs/vesta-2-development
HOW TO: Configure VestaCP/Exim to send email using SendGrid (CentOS 6)
HOW TO: Configure VestaCP/Exim to send email using SendGrid (CentOS 6)
I've noticed this seems to be a common issue, so I'm sharing the steps I took to get email successfully sending (and receiving) using SendGrid with VestaCP and Exim on CentOS 6.
Make sure that your domain is setup and validated in SendGrid and that your DNS/MX records are properly configured (use mxtoolbox.com to scan your domain. it will tell you if you need to fix anything.). It's also a good idea to make sure your reverse DNS is accurate.
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
1. Open Exim Configuration
2. You must configure Exim to Authenticate when sending email, or else you'll end up with 550 Authentication errors.
FIND
ADD BELOW
3. SendGrid Entries: Add the Credentials, Route and Transport to exim.conf
FIND
ADD BELOW
replace sendgridusername and sendgridpassword with your SendGrid login credentials.
FIND
ADD BELOW
FIND
ADD BELOW
4. Save exim.conf and exit
5. Restart Exim
You should now be able to successful send emails using the SendGrid service.
Make sure that your domain is setup and validated in SendGrid and that your DNS/MX records are properly configured (use mxtoolbox.com to scan your domain. it will tell you if you need to fix anything.). It's also a good idea to make sure your reverse DNS is accurate.
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
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 = *
Code: Select all
auth_advertise_hosts = *
3. SendGrid Entries: Add the Credentials, Route and Transport to exim.conf
FIND
Code: Select all
begin authenticators
Code: Select all
sendgrid_login:
driver = plaintext
public_name = LOGIN
client_send = : sendgridusername : sendgridpassword
FIND
Code: Select all
begin routers
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
Code: Select all
begin transports
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
Re: HOW TO: Configure VestaCP/Exim to send email using SendGrid (CentOS 6)
Hello,
can you tell how to this on centos 7?
I just tried the same steps in centos 7, but doesnt work.
can you tell how to this on centos 7?
I just tried the same steps in centos 7, but doesnt work.
Re: HOW TO: Configure VestaCP/Exim to send email using SendGrid (CentOS 6)
Tried again the same steps and it works also on centos 7 :)
Thanks
Thanks
Re: HOW TO: Configure VestaCP/Exim to send email using SendGrid (CentOS 6)
@ShaunWHD Hey, thanks for the guide!
After I've done the settings, I tested it with mail -s, it was able to send to my email. However, it won't send any notification after doing backups in vestaCP. Is it suppose to send email to my catchall email or admin email?
After I've done the settings, I tested it with mail -s, it was able to send to my email. However, it won't send any notification after doing backups in vestaCP. Is it suppose to send email to my catchall email or admin email?
Re: HOW TO: Configure VestaCP/Exim to send email using SendGrid (CentOS 6)
Hello thanks for the share, i have implemented the method but now i can send email but not reciving emails
-
- Posts: 2
- Joined: Sat Sep 09, 2017 5:56 pm
Re: HOW TO: Configure VestaCP/Exim to send email using SendGrid (CentOS 6)
thank finally its working for me after so many attempts to modify configsHassan wrote:Hello thanks for the share, i have implemented the method but now i can send email but not reciving emails
but I have also same problem now how can i receive mails. sending mail is working on port 2525,
how and where i can receive mail
Please help
thanks in advance.
-
- Posts: 6
- Joined: Wed Dec 13, 2017 12:45 am
- Os: CentOS 6x
- Web: apache + nginx
Re: HOW TO: Configure VestaCP/Exim to send email using SendGrid (CentOS 6)
Hey Shaun, thank you for this great post. I've worked through it and I've got emails sending through SSH, though I'm not sure if I've got myself stuck with the MX records. (I'm also still getting a 550 error in Roundcube webmail and can't send emails through this).ShaunWHD wrote:I've noticed this seems to be a common issue, so I'm sharing the steps I took to get email successfully sending (and receiving) using SendGrid with VestaCP and Exim on CentOS 6.
Make sure that your domain is setup and validated in SendGrid and that your DNS/MX records are properly configured (use mxtoolbox.com to scan your domain. it will tell you if you need to fix anything.). It's also a good idea to make sure your reverse DNS is accurate.
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 it1. Open Exim ConfigurationCode: Select all
cp /etc/exim/exim.conf /etc/exim/exim.conf-bkup
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.
FINDADD BELOWCode: Select all
host_lookup = *
Code: Select all
auth_advertise_hosts = *
3. SendGrid Entries: Add the Credentials, Route and Transport to exim.conf
FINDADD BELOWCode: Select all
begin authenticators
replace sendgridusername and sendgridpassword with your SendGrid login credentials.Code: Select all
sendgrid_login: driver = plaintext public_name = LOGIN client_send = : sendgridusername : sendgridpassword
FINDADD BELOWCode: Select all
begin routers
FINDCode: 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
ADD BELOWCode: Select all
begin transports
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 EximYou should now be able to successful send emails using the SendGrid service.Code: Select all
/etc/init.d/exim restart
I'm running on GCE and through mxtoolbox.com it's showing up as DNS records not found. I think I need to update the MX records directly in Google Cloud DNS, but I'm not sure if they should link to Sendgrid or if they should link somewhere else.
Did you have any idea what I should create for the MX records for this Instance? Or if they would be the problem that's causing the 550 error in mailweb?
Thanks in advance,
Bernard
-
- Posts: 1
- Joined: Mon Apr 30, 2018 7:38 am
- Os: CentOS 5x
- Web: apache + nginx
Re: HOW TO: Configure VestaCP/Exim to send email using SendGrid (CentOS 6)
Hi all
I faced some difficulty after activating my sendgrid account and thought I should share the solution.
after paying for your sendgrid account emails still do not go through until you change the sendgrid username and password on this line as mentioned earlier
client_send = : sendgridusername : sendgridpassword
note that the username should be apikey and the password is the key generated by sengrid that you would have copied.
Hope it helps you all.
I faced some difficulty after activating my sendgrid account and thought I should share the solution.
after paying for your sendgrid account emails still do not go through until you change the sendgrid username and password on this line as mentioned earlier
client_send = : sendgridusername : sendgridpassword
note that the username should be apikey and the password is the key generated by sengrid that you would have copied.
Hope it helps you all.
Re: HOW TO: Configure VestaCP/Exim to send email using SendGrid (CentOS 6)
Thanks for the guide. Im not knocking it but for me I wouldnt enable sendgrid globally for the following reasons.
Most 3rd pary software already have smtp relay section where you can over ride php mail to use an smtp relay like shopping carts, forums, etc and make it specifically used for that service. You can easily enter your sendgrid api login at the 3 party software on your sites without the risk of breaking your Exim configuration. Not that this procedure cant be accomplished safely. Exim is very powerful and versatile.
Another reason to enter smtp relay api at 3rd party sofware is so you dont route everything thru sendgrid. For example if you dont have sendgrids rip off 75/mo dedicated IP plan, they will put you on a shared ip in which often times getting blacklisted for a half a day. When it does, u want to quickly flip back to your real servers ip over theirs. You can do it click of a button at 3rd party software over revisiting the Exim configs.
A final reason not to enable sendgrid globally is you route mass emails via sendgrid but shouldnt for critical contact us emails where u can 100 percent rely on your own servers IP for deliverability and continue to build the reputation of your real ip.
Now if Vestacp includes a future option of entering the smtp relay logins in the panel where u can turn on and off, that would be sweet.
Again,
Thanks for the brilliant guide and what would be interesting is to see a guide where you can upload a suppression list to Exim of emails to never send to to preserve ip reputation of bad emails.
Most 3rd pary software already have smtp relay section where you can over ride php mail to use an smtp relay like shopping carts, forums, etc and make it specifically used for that service. You can easily enter your sendgrid api login at the 3 party software on your sites without the risk of breaking your Exim configuration. Not that this procedure cant be accomplished safely. Exim is very powerful and versatile.
Another reason to enter smtp relay api at 3rd party sofware is so you dont route everything thru sendgrid. For example if you dont have sendgrids rip off 75/mo dedicated IP plan, they will put you on a shared ip in which often times getting blacklisted for a half a day. When it does, u want to quickly flip back to your real servers ip over theirs. You can do it click of a button at 3rd party software over revisiting the Exim configs.
A final reason not to enable sendgrid globally is you route mass emails via sendgrid but shouldnt for critical contact us emails where u can 100 percent rely on your own servers IP for deliverability and continue to build the reputation of your real ip.
Now if Vestacp includes a future option of entering the smtp relay logins in the panel where u can turn on and off, that would be sweet.
Again,
Thanks for the brilliant guide and what would be interesting is to see a guide where you can upload a suppression list to Exim of emails to never send to to preserve ip reputation of bad emails.
Re: HOW TO: Configure VestaCP/Exim to send email using SendGrid (CentOS 6)
Server smtp.sendgrid.netIsaacNchito wrote: ↑Mon Apr 30, 2018 7:52 amHi all
I faced some difficulty after activating my sendgrid account and thought I should share the solution.
after paying for your sendgrid account emails still do not go through until you change the sendgrid username and password on this line as mentioned earlier
client_send = : sendgridusername : sendgridpassword
note that the username should be apikey and the password is the key generated by sengrid that you would have copied.
Hope it helps you all.
Ports
25, 587 (for unencrypted/TLS connections)
465 (for SSL connections)
Username apikey
Password YOUR_API_KEY
https://app.sendgrid.com/guide/integrate/langs/smtp
will exim automatically use the encrypted ports first?