I have an application built with CodeIgniter and hosted with a shared hosting provider.
My MX records point to Gmail servers and my app can send emails using Gmail with the standard CodeIgniter e-mail methods.
Now I want to send some transactional mails using SendGrid or Amazon SES. But that does not work and apparently the reason is that my hosting provider does not allow SMTP relaying.
I am thinking of using SendGrid APIs and cURL but I am not sure how well they will work with the CI methods that I am familiar with.
Preferably I would not want to change the MX records that are pointing to Gmail that handles the regular mails for our company.
Given the constraints, is there anything that can be done to send e-mails using SendGrid or Amazon SES?
You should use the SendGrid web API to send emails. If you’re ISP is blocking email, then your best bet is to switch to HTTP. It’s a pretty simple switch since it takes all the same parameters. Check out the docs for more info:
And I doubt it will work with the CI email library, but there’s no reason you can’t just use the SendGrid library:
Also, this CodeIgniter library sends SendGrid email via HTTP. Might be worth checking out.