skip to Main Content

I have got a webserver with plesk(with roundcube) and CloudFlare.
The problem is that the emails sent by the webserver have got the real ip of the server and not the CloudFlare ip.
Is there a way to send email from the cloudflare ip instead of the server ip?

2

Answers


  1. CloudFlare can’t proxy mail or MX records. If you don’t want your server IP to show, then you should look at using a different mail provider (Google Apps, etc.) that won’t reveal your IP.

    Some other helpful tips for securing your website.

    Login or Signup to reply.
  2. You can try this way to send e-mail with Cloudflare outgoing ip address.

    The only constraint currently is that the integration only works when the request comes from a Cloudflare IP address. So it won’t work yet when you are developing on your local machine or running a test on your build server.

    Then.. you must make this work from some origin proxied by Cloudflare linked to your own Cloudflare worker.

    export default {
      async fetch(request) {
        send_request = new Request('https://api.mailchannels.net/tx/v1/send', {
          method: 'POST',
          headers: {
            'content-type': 'application/json',
          },
          body: JSON.stringify({
            personalizations: [
              {
                to: [{ email: '[email protected]', name: 'Test Recipient' }],
              },
            ],
            from: {
              email: '[email protected]',
              name: 'Workers - MailChannels integration',
            },
            subject: 'Look! No servers',
            content: [
              {
                type: 'text/plain',
                value: 'And no email service accounts and all for free too!',
              },
            ],
          }),
        })
      },
    }
    

    Source: Cloudflare blog

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search