nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Call mutt macro from shell script

This is a discussion on Call mutt macro from shell script within the Mail Servers forums, part of the Mastering Servers category; They went through now. What I was thinking (saw the files categories but I guess I am too much into ...

Register free or login to your existing account and remove all advertisements.


Go Back   nixCraft Linux Forum > Mastering Servers > Mail Servers

Linux answers from nixCraft.


Mail Servers Discussion on Postfix/Sendmail Mail servers and related program such as IMAP/POP3, Anti-Spam technologies.

Reply

 

LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 06-20-2009, 02:35 AM
Junior Member
User
 
Join Date: Jun 2009
OS: Debian
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Rep Power: 0
gheorghiua is on a distinguished road
Default Call mutt macro from shell script

They went through now. What I was thinking (saw the files categories but I guess I am too much into mutt now)
Attached Files
File Type: txt fetchmailrc.txt (333 Bytes, 1 views)
File Type: txt procmailrc.txt (1,001 Bytes, 1 views)
File Type: txt muttrc.txt (2.8 KB, 1 views)
Reply With Quote
  #12 (permalink)  
Old 06-20-2009, 05:14 AM
Junior Member
User
 
Join Date: Jun 2009
OS: Debian
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Rep Power: 0
gheorghiua is on a distinguished road
Default

Just tested with the settings mentioned in the 3 files and it all works ok when executed after the new mail is passed to the folders. A command of c was added in the macro C which executes the saving of the attachment of the latest e-mail with subject CDR. However, there is the same complaint that 'No recipients were specified'. I guess at this point, there is no way to run a mutt command without actually interacting with the interface for acknowledgement of recieving new mail. In this situation it appears to me that somehow the command is interpreted as if an e-mail needs to be sent. Will keep digging.
Thanks again for the assistance and various tips which were of great help in understanding mail process in linux.
Reply With Quote
  #13 (permalink)  
Old 06-25-2009, 12:09 AM
Junior Member
User
 
Join Date: Jun 2009
OS: Debian
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Rep Power: 0
gheorghiua is on a distinguished road
Default

Quote:
Originally Posted by gheorghiua View Post
Just tested with the settings mentioned in the 3 files and it all works ok when executed after the new mail is passed to the folders. A command of c was added in the macro C which executes the saving of the attachment of the latest e-mail with subject CDR. However, there is the same complaint that 'No recipients were specified'. I guess at this point, there is no way to run a mutt command without actually interacting with the interface for acknowledgement of recieving new mail. In this situation it appears to me that somehow the command is interpreted as if an e-mail needs to be sent. Will keep digging.
Thanks again for the assistance and various tips which were of great help in understanding mail process in linux.
More on the testing:
I configured muttrc to toss the new messages from /var/spool/mail/alice to my home mail directory as seen below
Quote:
#From .muttrc
set mbox=+mbox #copy mail from spool here
20 set move=yes #don't ask abt moving messages, just do it
21 mailboxes \
22 $MAIL \
23 =cdrs \
24 =mbox*\
25 =postponed
, and even added a command that sends a message to me in my shell script
Quote:
echo "for cdrs" | mutt -s "cdrs" -f /home/alice/Mail/cdrs -e 'push "C"' alice@gmail.com
while it executes the macro.
I even created a piece of script that runs mutt macro again and scheduled it in cron to run after the failed script
Quote:
mutt -f /home/alice/Mail/cdrs -e 'push "C"<enter>'
All to no avail. But if I run the culprit macro above from the command line and press enter manually, all works perfectly.

Will continue investigating

Last edited by gheorghiua; 06-25-2009 at 12:12 AM. Reason: did not take the intended code in quotes
Reply With Quote
  #14 (permalink)  
Old 06-25-2009, 11:39 PM
Junior Member
User
 
Join Date: Jun 2009
OS: Debian
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Rep Power: 0
gheorghiua is on a distinguished road
Default

Is there a way to pass an <enter> within a shell (or simulate a keyboard <enter> ) somehow so I can emulate the mutt running as if I was running it manually?
I tried exit, echo blank, \n after the command line. Nothing worked.
Reply With Quote
Reply

Tags
cron , cronjobs , crontab , linux , mutt


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Call for Papers - NCOSS 2009, C-DAC Mumbai ncoss2009 The Hangout 3 05-14-2009 05:30 PM
Mutt in a script with attachments fkempers Shell scripting 1 12-28-2008 12:49 PM
Binary Conversion Of Shell Script (shell script compiler) chandanperl Shell scripting 3 07-29-2008 11:22 AM
Call Logging and Asset Mgmnt SW ricc Linux software 1 06-29-2007 02:45 AM
call function in bash mala_un Shell scripting 9 08-18-2006 02:36 AM


All times are GMT +5.5. The time now is 01:03 PM.


Powered by vBulletin® Version 3.8.4 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2009 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38