Thanx to all who tried to help and the hint from Owens Blaine works for me, his hint was #!/bin/ksh cat | munpack After this I was able to write my own script to get the explorer output through mail and extract it from mail, unzip and put it in a dir on the system. Dirk-Willem van Gulik - Check out the mpack/mupack tools. I use them with procmail and they work great for exactly this. Dw Glass, David - I didnt try this but its a good explanation Vipin Hi. I needed to do this a while ago (extract a mail and delete it). I haven't got the details with me but, if I remember correctly, I searched through the mail file until I found a section with the correct header. I used ed to write out a section of theis file and the to delete that section. I don't know how familiar you are with ed but it can be run a bit like an automated vi session so you are editing the original file, not like sed where you have to start making copies. Although if you don't need to delete the original mail then it is much easier. If you just want to extract the mail to a separate file you could use something like: awk '{if($1=="Subject:" && $2=="test")s=1;if(s==1 && $0=="")s=2;if($1=="From")s=0;if(s==2)print}' /var/mail/yourname > newfile Where the mail has the subject "test". You will need read access to the mail file. If you need to do anything more fancy then let me know and I can give you some pointers. Cheers David Mark mbergman@merctech.com - suggested formail and procmail ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ My original post was Hi Gurus, I have a scenario in which I am sending a mime attachment mail to an account on a system2 and I want that the attachment should be extracted from the message and saved in a file on system2 without user intervention. Does any body has any idea how it can be done with a script. To start with I have to write a script and in /etc/mail/aliases I can mention that script against the account e.g abc_account: "|/home/scripts/xyz.sh" So that whenever I will send a mail from system1 to abc_account@system2 it will execute xyz.sh script but I dont know how to start writing this xyz.sh For mime I can use munpack to extract that attachment from mail but question is how to get that mail in script so that I can say "munpack $file". Thanx Vipin _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagersReceived on Wed Dec 5 11:09:50 2001
This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:29 EST