Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 09-21-2004, 10:38 PM   #1
LQ Newbie
Registered: Dec 2003
Posts: 2

Rep: Reputation: 0
sendmail - strip attachments - is this possible


Is it possible to strip attachments from an email (as it comes in) and store it on the server. In addition, I will need to keep a log of each file that is stripped along with an email of the original message recipient.

The user will receive the message without the attachment.

Is this possible?


Old 09-22-2004, 08:23 AM   #2
Senior Member
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,991

Rep: Reputation: 76
It's certainly possible.

You will need to write a filter script to process a single message read from stdin. I'd suggest writing it in Perl and using Perl's built-in MIME handling to parse the email, and strip anything that isn't text/plain or text/html. You then have the script print out whatever is to be sent to the recipient, with the appropriate headers.

You then need to tell sendmail to use this script as a filter on all incoming email addresses. I don't know how to do that off-hand but it's a fairly common feature (you can definitely do this with qmail).


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Strip / Remove attachments (Replace with TXT file if Possible) Vince0000 Linux - General 2 09-17-2010 06:46 PM
strip -s blackzone Linux - Newbie 1 09-01-2004 12:08 AM
Sendmail & How to reject mail with executable attachments WorldBuilder Linux - Networking 3 02-04-2004 03:27 PM
sending attachments from sendmail in a script pr0fess0r Linux - General 2 05-20-2003 05:49 AM
Sendmail and attachments Satriani Linux - Software 2 04-27-2003 12:09 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:37 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration