LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   sendmail - strip attachments - is this possible (https://www.linuxquestions.org/questions/linux-software-2/sendmail-strip-attachments-is-this-possible-233639/)

irubin 09-21-2004 10:38 PM

sendmail - strip attachments - is this possible
 
Hello,

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?


Thanks.

-R

rjlee 09-22-2004 08:23 AM

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).


All times are GMT -5. The time now is 10:40 AM.