Re: handling text/plain based on extension of the file
Carlos, et al -- ...and then Carlos Puchol said... % hi, Hi! % % i was wondering how to do the following (if possible). In short, as you've probably seen, not in mutt. I don't think that it's a bad idea to have the capability of saying something like autoview text/plain filespec=*.mgd mgp %s but it obviously can't be done yet. % % i reveive ".mgp" files as text/plain attachments, because % most people don't know about magicpoint (a little known % but awesome presentation software), thus they don't have a % mailcap entry of "application/magicpoint; mgp %s" and % a mime entry of "application/magicpoint mgp". As has been discussed, this is a problem in the remote MUA. So what do we do when we get garbled mail from poor users running without the benefit of mutt? We use procmail, of course. While the following is untested, I should think that a rule like :0 fB * Content-Type: text/plain * Content-Disposition: attachment; filename=".*mgd" | $FORMAIL -A"Content-Type: application/magicpoint" would do the trick quite nicely, even if you do have to play with the Content-Disposition string match (maybe just Content.*filename or some such); upon detection of a message that has the matching Content-Type: and Content-Disposition: in the (B)ody, procmail (f)ilters the message through formail (typically defined, with full path and any args, and stored in $FORMAIL) to rewrite (without saving the old) the Content-Type: header. The only problem I see with this brilliant answer :-) is what to do if you are accesssing your mail via an IMAP connection and you do not have the ability to run procmail for your account. Stay tuned for the "how do I have mutt filter my mail?" FAQ entry, which I'm working on diligently (er, well, thinking about contemplating, anyway), which should address some IMAP-user filtering. % % is it possible for me to instruct mutt to invoke mgp % for those attachments that come as text/plan but the % extension of the attachment is .mgp? Once the Content-Type: header is correct, the rest should be easy -- and is left as an exercise for the reader ;-) % % i have dabbled around the manual a bit, but i am not % too experienced with muttrc settings. % % thanks, % % ++ carlos P.S. -- Even though you might see [EMAIL PROTECTED], please be sure to send to [EMAIL PROTECTED] since it's the proper address. :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.bigfoot.com/~davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg! The "new millennium" starts at the beginning of 2001. There was no year 0. Note: If bigfoot.com gives you fits, try sector13.org in its place. *sigh* PGP signature
Re: handling text/plain based on extension of the file
Thomas Roessler [EMAIL PROTECTED] wrote: To answer the original question: For mutt, no such thing as a file extension exists when it looks at how to interpret incoming data. well, but attachments have a comment field or something because i can see the name of the file being sent. it also puts it as a default file name when saving it. it would be nice to have the hooks to make viewer decisions based on that info. but i don't know mutt inside to tell how this can be to write, unfortunately. thanks for the response. ++ carlos
Re: handling text/plain based on extension of the file
Carlos Puchol [EMAIL PROTECTED] wrote: well, but attachments have a comment field or something because i can see the name of the file being sent. That's just a filename. MIME attachments also have a "Content-Type" header which is supposed to tell the MUA exactly what type of document is contained, and thus the mailer should know what to do with it. If the content-type is "text/plain", but the filename matches "*.gif", for instance, then the mailer that *sent* the message is clearly broken. It's not Mutt's fault that it tries to display an image as a text attachment, because that's what it was told by the sender to do! You should complain to the person who sent you the mail, and tell them to fix their mailer so that it sends things out correctly. That will help everyone. -- David DeSimone | "The doctrine of human equality reposes on this: [EMAIL PROTECTED] | that there is no man really clever who has not Hewlett-Packard | found that he is stupid." -- Gilbert K. Chesterson Richardson IT|PGP: 5B 47 34 9F 3B 9A B0 0D AB A6 15 F1 BB BE 8C 44
Re: handling text/plain based on extension of the file
On Fri, May 26, 2000 at 03:59:19PM -0500, David DeSimone wrote: Carlos Puchol [EMAIL PROTECTED] wrote: well, but attachments have a comment field or something because i can see the name of the file being sent. That's just a filename. MIME attachments also have a "Content-Type" header which is supposed to tell the MUA exactly what type of document is contained, and thus the mailer should know what to do with it. If the content-type is "text/plain", but the filename matches "*.gif", for instance, then the mailer that *sent* the message is clearly broken. It's not Mutt's fault that it tries to display an image as a text attachment, because that's what it was told by the sender to do! You should complain to the person who sent you the mail, and tell them to fix their mailer so that it sends things out correctly. That will help everyone. Yes, you are right, but... Have you actually tried telling someone who sends you mail like that that their mailer is broken? I have, on many occasions, a couple of them recently. It's an eye-opening experience. In one recent case, the author had absolutely no idea what I was talking about when I discussed the Content-Type header of her message. All she knew was that Outlook could send files, so she attached a file to her message and sent it. And of course it looked fine to everyone in her office, since they were also using Outlook. She was actually quite willing to fix the problem, but hadn't a clue where to even begin. And never having used Outlook, I couldn't really help her. I even had a fairly knowledgeable person here look into this and he couldn't find anything on the subject in his Outlook reference manual. (It's still an open issue.) Anyway, thanks to Microsoft there are broken mailers out there that aren't going to be fixed. We should still try to enlighten users and try to get these mailers fixed or replaced. In the mean time, however, it would be nice if mutt had a way to work around this problem. I hate the thought of making mutt as brain-dead as Outlook w.r.t. mail headers, but being a bit more forgiving in what it accepts would make mutt a more useful mailer. Maybe there could be some sort of consistency check between the Content-Type and the file name and if they disagree, process the message according to one or the other, the choice set by some quadoption variable (kind of like how reply_to works). -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | RF Communications Product Generation Unit | Spokane, Washington, USA
Re: handling text/plain based on extension of the file
Carlos Puchol proclaimed on mutt-users that: i reveive ".mgp" files as text/plain attachments, because most people don't know about magicpoint (a little known set auto view in .muttrc For example, I use auto_view application/ms-tnef text/x-vcard auto_view application/x-chess application/x-lotus-notes auto_view text/html application/x-gzip application/x-gunzip auto_view application/rtf application/x-rath -- Suresh Ramasubramanian | sureshr at staff.juno.com He who attacks the fundamentals of the American broadcasting industry attacks democracy itself. -- William S. Paley, chairman of CBS
Re: handling text/plain based on extension of the file
Suresh Ramasubramanian [EMAIL PROTECTED] wrote: Carlos Puchol proclaimed on mutt-users that: i reveive ".mgp" files as text/plain attachments, because most people don't know about magicpoint (a little known set auto view in .muttrc For example, I use auto_view application/ms-tnef text/x-vcard auto_view application/x-chess application/x-lotus-notes auto_view text/html application/x-gzip application/x-gunzip auto_view application/rtf application/x-rath but i don't think i want to just autoview text/plain attachments, no? i want mgp to handle the text/plain attachments that have an "*.mgp" as file name whe i press "view-attachments" on it. ++ carlos
Re: handling text/plain based on extension of the file
Carlos Puchol proclaimed on mutt-users that: but i don't think i want to just autoview text/plain attachments, no? i want mgp to handle the text/plain attachments that have an "*.mgp" as file name whe i press "view-attachments" on it. Oh ya - then write a macro to pipe it to magicpoint. -- Suresh Ramasubramanian | sureshr at staff.juno.com He who attacks the fundamentals of the American broadcasting industry attacks democracy itself. -- William S. Paley, chairman of CBS
Re: handling text/plain based on extension of the file
On 2000-05-25 17:42:17 +0530, Suresh Ramasubramanian wrote: i reveive ".mgp" files as text/plain attachments, because most people don't know about magicpoint (a little known set auto view in .muttrc For example, I use auto_view application/ms-tnef text/x-vcard auto_view application/x-chess application/x-lotus-notes auto_view text/html application/x-gzip application/x-gunzip auto_view application/rtf application/x-rath *grin* I don't think you have a handler for x-rath, have you? ;-) Actually, this looks like cut-n-paste from my published muttrc. Anyway, this won't help. To answer the original question: For mutt, no such thing as a file extension exists when it looks at how to interpret incoming data. This implies that about the only possibility you have is to use the edit-type function to change the attachment's content type, and then use the normal MIME handling. If you want to make this change persistent, you should most likely use the edit-message function instead... -- http://www.guug.de/~roessler/
Re: handling text/plain based on extension of the file
Thomas Roessler proclaimed on mutt-users that: auto_view application/ms-tnef text/x-vcard auto_view application/x-chess application/x-lotus-notes auto_view text/html application/x-gzip application/x-gunzip auto_view application/rtf application/x-rath *grin* I don't think you have a handler for x-rath, have you? ;-) Actually, this looks like cut-n-paste from my published muttrc. Ya it is ... my muttrc is a weird mix of stuff from yours, Roland Rosenfeld's and a few other muttrcs ;) -- Suresh Ramasubramanian | sureshr at staff.juno.com Very few profundities can be expressed in less than 80 characters.