Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
1. A user's home dir is /home/user, so in your case it's /home/kashif. You should put .procmailrc in there.
2. You can put the perl script where you want, just make sure it's executable. For example if you name the script attachment.pl and put it in /usr/local/bin, you have to run:
Code:
chmod +x /usr/local/bin/attachment.pl
You don't need anything in /etc/mail/aliases if you're going to use the procmail approach
3. The code means that if there is an attachment with a .wav extension, then run the command after the "|". That is /usr/local/bin/attachment.pl, if you have created the script like in the step 2 above.
Assuming that you have created the perl script and edited it to save the attachments where you want, then this is it.
You should try it, to see if you need to change permissions in the directory where you want the attachments to be saved.
Hi,
Yes i have created the script but i want to ask that when i will make .procmailrc file in /home/kashif then what this file contain, is it empty file or any script or what thing it has to be, this is i am asking.
Hi,
Thank you for your help but procmail is not working for me, This is my .procmailrc file in /home/kashif which contain the code
Code:
#The code means that if there is an attachment with a .wav extension, #then run the command after the "|". That is /usr/local/bin/attachment.pl
:0 B:
* ^Content-Type: .*;$[ ]*(file)?name=\"?.*\.(wav)\"?$
|/usr/local/bin/attachment.pl
One thing more is i supposed to restart anything after creating this procmailrc file, and will this code is write in one line or copy as it is as you posted means after $ there is line break or not . And in attachment.pl I changed the line like
INBOX is an empty folder ok in which i suppose to forward voice-mail part of my mail.
I also removed the line kashif: /var/spool/asterisk...... in /etc/aliases but one thing that i want to tell you is that when i was using this line in /etc/aliases then the mail is going to root mail box and it showed that it failed to send mail to var/spool/asterisk.....
Right now mail is going to kashif mailbox
i didn't fine any procmail log also may be it contain something about this any ways and idea where i am doing wrong and any hint or help please
Thanks in advance
Are you sure you have procmail installed?
Procmail does not need a restart. It's used by sendmail to deliver mail to the user's mailbox. If it finds a .procmailrc in the user's homedir then it delivers the mail according to the rules in that file.
so i think it is installed. Is there any other critaria to check whether it is running or not or running with send mail.
Where is procmail log messages store may be it showed something usuful, while searching i came to know that by inserting verbose = yes in .procmailrc you able to see prcomail log meesages
Or what about the code, there is line break after $ sign or not and what is :0 B: indicating in the code
Maybe your sendmail is not configured to use procmail (most unlikely). Check sendmail.mc to see if you have procmail as mailer.
If you want to get procmail logs, edit .procmailrc and add at the beginning:
# :0 :B tells procmail to grep the body of the email for a .wav #extension. The code means that if there is an attachment with a .wav #extension,then run the command after the
#"|". That is /usr/local/bin/attachment.pl
The .procmail directory you created must be owned by the user in question (that is kashif). The log file is created automatically, as the user receives his 1st email. Since procmail tried to write to the logs, that means that it works. The fact is that it does not filter the wav attachments somehow.
Are you sure you have removed the .forward and the user alias?
BTW you don't need quotes around the commands in .procmailrc.
[root@ns9 ~]# ls -la /home/kashif/.forward
ls: /home/kashif/.forward: No such file or directory
Also my /etc/aliases file doesn't contain kashif.But I have changed the owner and group of .procmail directory and now the log is showing. These are the lines in the log file of procmail.log
procmail: [13734] Tue Nov 3 16:36:12 2009
procmail: No match on "^Content-Type: .*;$[ ]*(file)?name=\"?.*\.(wav)\"?$"
procmail: Locking "/var/mail/kashif.lock"
procmail: Assigning "LASTFOLDER=/var/mail/kashif"
procmail: Opening "/var/mail/kashif"
procmail: Acquiring kernel-lock
procmail: Unlocking "/var/mail/kashif.lock"
procmail: Notified comsat: "kashif@0:/var/mail/kashif"
From basit_mahmood@netkarachi.com Tue Nov 3 16:36:12 2009
Subject: VoiceMail: test voice mail
Folder: /var/mail/kashif 128598
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.