Emailed PDF's are damaged and can't be opened


Hi there, yesterday I signed up with Cloudflare and changed my name servers from godaddy to you Cloudflare.

Since then customers are complaining some emails they receive (PDF’s) are unable to open. The error message says the “file maybe damaged”

Our whole business relies on these emails and the customers must receive a PDF copy by law.

How do we go about resolving the issue.

Any help would be most appreciated.



Cloudflare doesn’t proxy email and your mail server communicating outbound would not utilize Cloudflare. Have you verified the system generating the emails is creating them properly? Are you able to reproduce the issue sending yourself test messages with the same files?


Thanks for the reply. The system is definitely creating the PDF’s fine. The customer receives the email but can’t open the attached PDF


The system sending the mail would open a connection directly to the receiving MTA specified in the customer’s MX record (no Cloudflare involved). When you have the system send a test message to you with a PDF can you open the file?


I’ve ruled out application as it works local. So as I’ve just switched to Cloudflare it must have something to do with it. My ip is whitelisted and security set to minimum. The email is sent so SMTP is fine. Not sure what to do.


I’m going away for a few days tomorrow so I’m gonna have to switch the DNS back over until I get back.


Correlation does not equal causation. Cloudflare is an inbound proxy for http/s & websocket traffic. We don’t proxy SMTP. If you look in your SMTP logs you will see your MTA opening a direct connection to a receiving MTA (either a relay of your own or the customer’s MX record) with no Cloudflare in the mix.

I’m certainly open to the possibility that it’s a Cloudflare issue, because it’s the internet and anything is possible, but rather than ruling out your application without performing the tests requested, I would recommend doing your due diligence at each step to verify the results.


I understand and appreciate your help. I’ve tested the application thoroughly (locally) no issues. I’ve tested end points of emails and PDF’s

All logs are showing no errors. I’ve switched the DNS back, as soon as this propagates I’ll check to see if the PDF’s are working. At least this way it may help narrow things down.

I’ll update soon.


The other thing to check I guess is that your app isn’t calling out back through Cloudflare to communicate with itself. That may cause a timing or other issue which could corrupt the data (DNS resolution for the origin on the origin should point to it’s local IP).


Good point. I’ll have to check this when I get back. Next time I change the DNS I’ll do it Friday evening so the customers don’t get hacked off. Cheers


You was right!!

Just checked and the system does communicate back to get the PDF. So yes it will go back through Cloudflare. Any idea how I can resolve the issue when I eventually change the DNS back to Cloudflare?


This can be a issue when sending attachments using Rich Text messages encapsulated in (TNEF). I’d first test using text only then html only.


It may be as simple as adding an entry to your local hosts file w/ the server name / local IP.


I hope so.

The DNS is now back with Godday and I can confirm the PDF’s are working fine. When I get back to the UK I’ll make the DNS switch and try again.

Appreciate the help.


Well I’m back in the UK and ready to solve this issue. As you mentioned in your last post I added the IP to my local host file. Unfortunately this stopped any emails from being sent.

The DNS still points to Godaddy.

This can be a issue when sending attachments using Rich Text messages encapsulated in (TNEF). I’d first test using text only then html only

The emails we produce need to be HTML, changing to plain text would degrade the user experience.


What does stops any emails from being sent mean? Does the application generating the PDFs error out? Does the MTA have issues?


When a customer signs a document and hits save, a HTML email is generated and a PDF copy of the document is created as an attachment. When I added the server name entry to the local host no emails got sent.

There were no errors.


I’d suggest having the developer of the app take a look at their code then to determine why the PDF isn’t being generated or why the MTA is failing to email out the message. On the machine itself can you connect to port 443 using the IP address you specified in the localhost file?