First off, I’d recommend possibly contacting people in the “Ruby’s Mail Discussion Group”
I was saying that the problem might be that there are extraneous “Mime-Version” and “Date” headers at the start of each of the 2 parts of the multi-part message. These headers are needed (“Date” is required for all emails and “Mime-Version” is required multi-part messages) at the email message level (the first chunk of headers before the multi-part sections in the body). However, these headers are not needed in the header sections of the individual parts of the multi-part message. My theory is that some clients may (incorrectly) be choking (and not displaying the fact that you’ve got an attachment) because of these unnecessary headers.
This is totally a shot in the dark. Without combing through all the email/multi-part/mime RFCs and doing extensive testing of this theory using hand-crafted messages in many email clients, I have no way to verify this.
My actual recommendation to you is that you really see if you can somehow get a communication channel directly to a client that next reports having this problem. My understanding being that your problem is sporadic. I don’t know how your organization/company is setup and/or how many layers/levels of organizational/corporate barriers exist to make this difficult or impossible. But you need to reproduce the problem else all we can do is speculate.
Perhaps you could include a footer/sub-text on messages w/instructions that clients contact a specific email address or phone number if they get an email and they can’t see their attachments? Then have at least a few instances of the next few support requests for this specific problem redirect to you or your development team. Then you could perhaps talk the client through the steps necessary to tell you exactly what type and versions of OS and email client software their running. You could also have them send the broken message to you by forwarding it as an attachment.
Then you can extract the message and set up a test environment w/the broken email client software and verify that the forwarded email doesn’t “work” in said client. At this point, using a simple text editor, you could then test theories as to why its broken by making a series of changes (keeping the original) one at a time to the email and opening it in the broken client until you isolate the exact aspect of the message causing the client to not display the attachment.
Only then, once you know what the real problem is, can you get advice as to what to do using actionmailer and the mail gem to send emails that won’t have the attachment problem.
I sympathize with you. I basically had a very similar problem and had to solve it for my company using this technique. However, my problem had to do with Thunderbird not liking the default way the hierarchy of “parts” in our multi-part messages (as created by the mail gem using the most obvious message construction code) were constructed/organized. Your example, however, was a simple “multipart/mixed” mixed message w/a text part and an attachment. If this is how all your messages are structured (no “multipart/alternative” stuff) then you’ve got a different problem that me.
Hope you find what the problem is.