1

Problem: I send out an email (using phpmailer and sendmail) which has a complex html attachment. I don't want the email client to attempt to display the attachment, since it's far too complex to be viewed in a mail reader.

As far as I can make out, the way to do this is to set content-Disposition to attachment. The default in phpmailer is to set it to attachment anyway. However, Thunderbird (the only client I've tested so far) does actually attempt to display the html. If I view the headers in Thunderbird, I can't see a Content-Disposition, but if I save the mail I can see:

--b1_420d367a26870bbc3bae73fb1de31f49
Content-Type: application/octet-stream; name="chart.html"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="chart.html"

Thunderbird has given the attachment the correct name, so it presumably understands the Content-Disposition. Is there something I can do with phpmailer to stop clients displaying html attachments, or can clients just do what they want?

Sending a compressed file isn't really an option - the users may not be sophisticated enough to know what to do with it.

EML
  • 9,619
  • 6
  • 46
  • 78

2 Answers2

1

David :Bienvenu 2006-04-07 12:49:31 PDT for historical reasons, this is done intentionally and has been since Netscape 2.0 and Mozilla 1.0...we display inline the attachments we know how to display unless you turn off view | attachments inline. Perhaps we could add a pref for respecting the content-disposition for all attachment types.

https://bugzilla.mozilla.org/show_bug.cgi?id=147461

This has been a known behavior since at least 2002. As far as forcing it to not be displayed inline, I'm not sure that it can be done except by the user setting a pref as mentioned in the bug report.

taiganaut
  • 196
  • 2
  • 8
0

How about saving it as pdf instead?

You can take a look at " Convert HTML + CSS to PDF with PHP?"

Community
  • 1
  • 1
iWantSimpleLife
  • 1,944
  • 14
  • 22