Find the answer to your Linux question:
Results 1 to 10 of 10
Hello, I've just set up CentOS 5 and Zenoss. After adding my devices and such, I figured it was time to start the reporting system. I want zenoss to send ...
  1. #1
    Just Joined!
    Join Date
    Nov 2007
    Posts
    6

    Auto prosessing mail from command line

    Hello,

    I've just set up CentOS 5 and Zenoss.
    After adding my devices and such, I figured it was time to start the reporting system.
    I want zenoss to send a mail that should be prosessed and sent through an SMS gateway.

    First thing, I set up an account named sms, which now recieves the mail zenoss sends.
    Then I downloaded gnokii, set it up properly, so now I can send sms from command line. Then i downloaded mail2sms which is nifty because it compresses the messages, removing headers and such, makes it a good sms format.

    All of this works - Fine!

    My problem is the command 'mail'. In my former monitoring solution which consisted of gentoo and nagios, the mail was delivered in files, (something like /root/.maildir/new/200711281435)

    In my current system, the mail is delivered to /var/spool/mail/sms/
    Can I use the mail command to parse the mail through a script, and remove it from my 'inbox'? (Thus doing mail, 1, scrolling down, ctrl+d and parsing the output to a file instead of stdout, all without a touch of a button?)

    Thanks in advance,

    \\makraves

  2. #2
    Linux Enthusiast
    Join Date
    Aug 2006
    Location
    Portsmouth, UK
    Posts
    539
    Hi makraves,

    Your best bet is to see if you can change the mail format of your MTA from mbox to maildir.

    mbox is what you have now, one flat file, maildir is what you had before lots of files in a folder.
    RHCE #100-015-395
    Please don't PM me with questions as no reply may offend, that's what the forums are for.

  3. #3
    Just Joined!
    Join Date
    Nov 2007
    Posts
    6
    allright, yeah. that sounds just about right:=)
    But how do one accomplish such a magnificent thing?

  4. #4
    Linux Enthusiast
    Join Date
    Aug 2006
    Location
    Portsmouth, UK
    Posts
    539
    Which MTA are you using ?

    Probably sendmail, postfix ro exim
    RHCE #100-015-395
    Please don't PM me with questions as no reply may offend, that's what the forums are for.

  5. #5
    Just Joined!
    Join Date
    Nov 2007
    Posts
    6
    Hello,

    Thanks for reply.
    I'm using sendmail, postfix is not installed.

    \\makraves

  6. #6
    Linux Enthusiast
    Join Date
    Aug 2006
    Location
    Portsmouth, UK
    Posts
    539
    Ok, send you slightly down the wrong path, the Delivery Agent stores the mail by default on RedHat Systems that's fetchmail which doesn't support maildir only mbox.

    You can change the agent to procmail though.

    Have a look at this link
    RHCE #100-015-395
    Please don't PM me with questions as no reply may offend, that's what the forums are for.

  7. #7
    Linux Enthusiast
    Join Date
    Aug 2006
    Location
    Portsmouth, UK
    Posts
    539
    A couple more RedHat links:

    email
    Delivery Agents
    RHCE #100-015-395
    Please don't PM me with questions as no reply may offend, that's what the forums are for.

  8. #8
    Just Joined!
    Join Date
    Nov 2007
    Posts
    6

    procmail

    Thank you. That was very helpful.
    Just installed procmail, and made a config file looking somewhat like this:
    (actually it looks exactly like this....)

    SHELL=/bin/bash
    LINEBUF=4096
    PATH=/bin:/usr/bin:/usr/local/bin
    VERBOSE=off
    MAILDIR=$HOME/Mail
    LOGFILE=$HOME/Mail/procmaillog
    FORMAIL=/usr/bin/formail
    SENDMAIL=/usr/sbin/sendmail

    :0:
    * ^TOsms@localhost
    /home/sms/Mail/smsbox/

    # Added also this:

    * ^TOsms@super.xxx.no
    /home/sms/Mail/smsbox/

    Will this make mails end up in /home/sms/Mail/smsbox ? (in file form)

    I've made all the folders mentioned above (in /home/sms)
    the .procmailrc is located in /home/sms/

    When I try to send mail to sms@localhost, the mail is delivered in the 'normal' way, to an mbox. (/home/sms/mbox)

    After procmail is installed, and .procmailrc is put in the /home/sms/ dir, is there anything else that has to be done in order for procmail to work? Do I have to start it somehow?

    Sorry for posting stupid and / or ridiculous questions, I'm a bit new on manual mail prosessing and such...

    \\makraves
    Last edited by makraves; 11-30-2007 at 02:06 PM. Reason: Rewrote .procmailrc

  9. #9
    Linux Enthusiast
    Join Date
    Aug 2006
    Location
    Portsmouth, UK
    Posts
    539
    I must admit to not being a postfix config guru.

    But it looks good to me...

    And no you shouldn't need to do anything for procmail to work
    RHCE #100-015-395
    Please don't PM me with questions as no reply may offend, that's what the forums are for.

  10. #10
    Just Joined!
    Join Date
    Nov 2007
    Posts
    6
    Strange.

    This does not work.

    Could I urge someone to take just a peak at my .procmailrc in this thread?

    Thanks a bunch,

    \\makraves

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...