I use cloudflare on my website and I want my server IP address (ORIGIN IP) to be closed to avoid DDoS attacks sent directly to my server IP address. My server uses Apache, PHP, MySQL.
When using php mail to send email (even if I use the phpmailer library to send email via external SMTP), the IP address of my server is added to the mail headers. This happens with Google SMTP, Mailgun and others, because it is probably in their policy to write in the header the IP address from which the mail was received.
At the moment, this is the only solution that I have in mind and requires a lot of effort, which consists in creating my own REST API and sending emails through another server, something like this:
ORIGIN SERVER IP sends email data in text format via my REST API to MY MAIL SERVER IP, and then MY MAIL SERVER IP uses the php mail function with phpmailer to send email via SMTP to the user. Thus, the IP address of MY MAIL SERVER will appear in the email headers, and not in the IP address of the ORIGIN SERVER.
Is there a more elegant way to do this? Is there a mail service that offers an API for recreation, and if I use their APIs, they will not display the IP address of my server in the email headers? Or maybe a REST API / library has already been developed for sending emails remotely, as I requested, so I donβt have to develop and test my own from scratch?
source share