Linux / UNIX Tech Support Forum
This is a discussion on Call mutt macro from shell script within the Mail Servers forums, part of the Mastering Servers category; I have a macro code that selects a particular message and saves the attachment file to a directory, and exits. ...
|
|||||||
| Mail Servers Discussion on Postfix/Sendmail Mail servers and related program such as IMAP/POP3, Anti-Spam technologies. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I have a macro code that selects a particular message and saves the attachment file to a directory, and exits.
I created a bash script which calls mutt as follows: Code:
mutt -e 'push "i"'' if [ -s cdrs.csv ]; then mv cdrs.csv vitcd.csv chmod 755 vitcd.csv However, when this script is executed from cron or command line it gives the following errors: Code:
No recipients were specified. Vitelity raw file could not be generated!" Code:
macro index i "<l ~d<1d,l ~s CDR^M<enter>v<next-entry><next-entry>s<enter><exit><exit><exit>" Thanks so much Last edited by nixcraft; 17-06-2009 at 04:46 AM. Reason: added |
| Sponsored Links | ||
|
|
|
||||
|
Are you running this from your own crontab or from root users crontab?
__________________
Vivek Gite Linux Evangelist |
|
||||
|
Few quick things try using full path to mutt (/usr/bin/mutt)
Export the variables (cron will not export all these variables):
Code:
export MAIL=/var/spool/mail/vivek PHP Code:
Code:
# use /bin/bash to run commands SHELL=/bin/bash # mail any output to vivek MAILTO=vivek
__________________
Vivek Gite Linux Evangelist |
|
|||
|
I tried suggestions 2. Suggestion 3 was already applied on crontab. As far as suggestion 1 it seems cron already finds the var/spool/mail/alice, and tested again with the same results. Forgot to mention, I have fetchmail that is transferring the e-mail from my gmail account. The settings being in the fetchmailrc. What I have noticed though, is that after I run the first time around, with failure, and if I open the terminal I am alerted that new mail is waiting in /var/spool/mail/alice. After that if I run the script again with fetchmail and mutt it successfully saves the desired attachment and completes the rest of the steps. My question would be now how can I supress this message by a command which will place the e-mail to the mbox which is on my home directory.
Thank you again so much for all the suggestions. |
|
||||
|
So fetchmail download email from gmail pop3 server and mutt moves attachments to folders? Try mda command in $HOME/.fetchmailrc
Code:
poll pop3.gmail.server protocol pop3 user 'you@gmail.com' password 'your-gmail-password' mda '/home/you/path/to/mutt.bash.script.sh'
__________________
Vivek Gite Linux Evangelist |
| The Following User Says Thank You to nixcraft For This Useful Post: | ||
gheorghiua (17-06-2009)
| ||
|
|||
|
I tried adding the mda on the .fetchmailrc and re-ran the script with the following result:
Code:
cat cdrtest.log we move to cdrf and run fetchmail 2 messages for alice@ringplus.net at pop.gmail.com (70785 octets). reading message alice@ringplus.net@pop.gmail.com:1 of 2 (8256 octets)........we move to cdrf and run fetchmail fetchmail: another foreground fetchmail is running at 25170. we now run the mutty Wed Jun 17 13:45:06 EDT 2009 No recipients were specified. No recipients were specified. Vitelity raw file could not be generated! flushed reading message alice@ringplus.net@pop.gmail.com:2 of 2 (62529 octets). Last edited by nixcraft; 18-06-2009 at 10:18 PM. Reason: ad a comment which I forgot |
|
||||
|
Yes, you can use something as follows which redirect common virus attachments including zipped versions using procmail.
Code:
:0 B
* name=.*(document|readme|doc|text|file|data|test|message|body)\.(vbs\"|wsf\"|vbe\"|wsh\"|hta\"|scr\"|pif\"|exe\"|shs\"|bat\"|bas\"|cmd\"|zip\")
{
:0
/dev/null
}
__________________
Vivek Gite Linux Evangelist |
| The Following User Says Thank You to nixcraft For This Useful Post: | ||
gheorghiua (19-06-2009)
| ||
|
|||
|
I put together a .procmailrc file with a setting I thought maybe my case. I attached herein the 3 config files (.muttrc, .fetchamilrc, .procmailrc hope they were taken in my upload
). I found there is a new player now: 'sendmail' program which is set-up in the .procmail, and I am asking how I would run now the fetchmail and mutt to accomplish the following:1. Get the e-mail from my gmail pop server 2. Move the e-mail from my provider (specified in .procmailrc) 3. Run mutt in command line and select that particular mailbox cdrs (which is in ~/Mail/cdrs) and operate on the newest message (the macro I have will take care of the message once I tap in that mailbox acording to a command line option for mutt or a .muttrc setting). Sorry for being a pain. Thanks so much again for any tips on how to 'put order in the chaos '
|
|
||||
|
Rename and upload them as a text file.
__________________
Vivek Gite Linux Evangelist |
![]() |
| Tags |
| cron , cronjobs , crontab , linux , mutt |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Call for Papers - NCOSS 2009, C-DAC Mumbai | ncoss2009 | The Hangout | 3 | 14-05-2009 04:30 PM |
| Mutt in a script with attachments | fkempers | Shell scripting | 1 | 28-12-2008 11:49 AM |
| Binary Conversion Of Shell Script (shell script compiler) | chandanperl | Shell scripting | 3 | 29-07-2008 10:22 AM |
| Call Logging and Asset Mgmnt SW | ricc | Linux software | 1 | 29-06-2007 01:45 AM |
| call function in bash | mala_un | Shell scripting | 9 | 18-08-2006 01:36 AM |