edwyr has asked for the wisdom of the Perl Monks concerning the following question:

I have a requirement to put a mail relay in my DMZ and to not let that mail relay send to the internal mail server. I need to have the internal mail server poll for new messages on the DMZ server with some frequency. I have (I think) everything read on the DMZ mail relay. What I need is something that works the opposite of rmail(8) for the DMZ mail relay side.

What I'm thinking is a perl script that opens each message in /var/spool/mqueue (each message has one df* file and one qf* file), create an output stream that is compatible with rmail(8) or procmail or something that can use deliver(8) from Cyrus, then finally delete the message on the DMZ mail relay.

Is there already a module for opening /var/spool/mqueue and properly formatting the messages (envelope and message)?

Replies are listed 'Best First'.
Re: Pulling from /var/spool/mqueue?
by InfiniteSilence (Curate) on Jan 31, 2008 at 20:36 UTC
    Have you looked at Mail::Action?

    Celebrate Intellectual Diversity

      Yes, thanks. I read the POD for Mail::Action and it will not do what I need. The messages are received from the internet by sendmail(8) and sendmail(8) stores the messages to /var/spool/mqueue as df* and qf* files. I am looking for something that will open the df*/qf* file pair and emit to stdout something that rmail(8) can read and deal with.

        If you have procmail or .forward support, launching Mail::Action or something similar from there may be easier than parsing mqueue files.

Re: Pulling from /var/spool/mqueue?
by marcussen (Pilgrim) on Feb 04, 2008 at 05:15 UTC
    This might not be what you wish, but; have you considered mounting the remote queue via NFS and having the queue processed by the local MTA (sendmail)?