How to send emails if your hosting provider does not allow SMTP relay?

I have an application built using CodeIgniter and shared with a hosting provider.

My MX records point to Gmail servers, and my application can send emails using Gmail with CodeIgniter standard email methods.

Now I want to send some transactional emails using SendGrid or Amazon SES. But this does not work, and apparently the reason is that my hosting provider does not allow SMTP relay.

I mean using the SendGrid and cURL APIs, but I'm not sure how well they will work with the CI methods I am familiar with.

It’s advisable that I don’t want to change MX records pointing to Gmail, which processes regular emails for our company.

Given the limitations, is there anything that can be done to send email using SendGrid or Amazon SES?

+4
source share
2 answers

You must use the SendGrid web API to send email. If you are ISP blocking email, it is best to upgrade to HTTP. This is a fairly simple switch, as it accepts all the same parameters. Check out the docs for more info:

http://docs.sendgrid.com/documentation/api/web-api/mail/#send

And I doubt that it will work with the CI electronic library, but there is no reason why you cannot just use the SendGrid library:

https://github.com/sendgrid/sendgrid-php


In addition, this CodeIgniter library sends SendGrid emails over HTTP. Perhaps worth checking out.

+2
source

You can use alternative ports with SendGrid:

Many hosting providers and Internet service providers block port 25 as the default practice. When trying to connect to smtp.sendgrid.net, remember that ports 25, 2525, 587, and 465 are available for use. You can connect via unencrypted or TLS on ports 25, 2525 and 587. You can connect via SSL on port 465.

- http://docs.sendgrid.com/documentation/get-started/smtp-ports/

+4
source

Source: https://habr.com/ru/post/1443041/


All Articles