How to email attachments?

How do I strip email attachments server side, or send email with attachments to a different address?

  • How do I strip email attachments server side? Or, alternatively, how do I redirect email containing binary attachments to an alternate email address? I own my own domain and, because I am forced to use Outlook, I don't want attachments touching my inbox. [more inside] My initial thought was to use procmail, but all the procmail approaches I've seen appear clunky and unreliable, at best. Then again, this is not my forte, so maybe I just don't understand what I'm looking at. My domain is pretty much full-featured, and I'm willing to switch hosting providers to get the tools I need to do this job right. So any practical technology solution is fair game. Thanks in advance. I appreciate it.

  • Answer:

    How about having procmail run it through a perl script? Perl has excellent message parsing modules (see http://search.cpan.org), and should be able to do both detection and stripping quite easily. (for redirecting, make the perl script return an exit status based on whether there's a bad attachment or not and then forward based on that).

gd779 at Ask.Metafilter.Com Visit the source

Was this solution helpful to you?

Other answers

Why are you forced to use Outlook?

Pericles

what's the problem with procmail (why does it look unreliable)? it's not inherently unreliable (it's the standard mail filtering tool, used everywhere - as i guess you know). is the problem how to select the right messages? if it's just that procmail is complicated, i'd suggest asking a procmail mailing list (or discussion group or wiki or whatever the appropriate support group is). i don't have to deal with outlook, but i do a simple filter of all incoming messages over a certain size (i also filter based on sender, check against black lists and call spam-assassin). it works reliably.

andrew cooke

what's the problem with procmail Procmail is great - for what it does. But it doesn't appear to have been designed for this sort of task, and as a result it doesn't appear to be great at recognizing or dealing with binary attachments. Then again, maybe I just don't know what I'm talking about. Filtering by size isn't a perfect solution, but it might work in most cases. I hadn't thought of that. fvw may be on to something with his suggestion. I don't know anything about perl, but I'm looking into it. Why are you forced to use Outlook? Because I use http://www.caelo.com/. I get far too much email each day to function without it.

gd779

NEO claims to "Effortlessly transform Microsoft Outlook into a complete email organizer." Wouldn't it be easier to just use a good e-mail program in the first place, rather than using Outlook plus a third-party add-on to bring it up to par?

kindall

Wouldn't it be easier to just use a good e-mail program in the first place Over the years, I've used just about every email program out there, from The Bat! to PicoMail to Netscape to Pine, and nothing lets me handle email as efficiently as NEO. (Well, Pine's more efficient in terms of raw keystroke speed, but NEO makes it easier to track relationships and email history, which is important to me and makes NEO more efficient on the whole). Using NEO, I cut my time spent on email down from about 2 hours a day to about 30 minutes, plus I'm much more organized, which means I never miss the important emails in the mass of unimportant emails, and I never lose track of the emails I really want to read but don't have time for right now. Plus it's zero-configuration, which I think is an important value in personal information management software. I'm sorry, I sound like a commercial here, so I'll stop. I just really like the program.

gd779

gd779: Predicated on your being root (or able to otherwise su mail) on the mail servers in question, what you're looking for is a combination of http://www.exim.org/, the exiscan patches along with the various utilities it uses to cope with attachments, and basic procmail rules. If your stiffed with another MTA, look into its filtering and tagging possibilities. sendmail offers something called "milters" that seem to be capable of some of this functionality. Postfix probably has something as well, although I'm not familiar enough with it to say what that is. There's pretty much no excuse not to be using Exim in modern times. If you've only got control of MDA or MUA, Procmail is going to have to do. You'll be writing some shell scripts to string together mime-defang and such to implement your rules. Not pretty, but doable.>

majick

Procmail in conjunction with Anomy Sanitizer

mecran01

(Er. Oops. http://duncanthrax.net/exiscan-acl/. Glad I previewed so carefully.)

majick

Thanks, majick. Following on your suggestion, I think I've found a working solution. After some more testing, I'll come back here and post the details in case anyone with the same question ever finds this post using Google.

gd779

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.