This request for assistance is a train wreck, with cars strewn everywhere, chaos ensuing, the carnage preventing everyone from being able to see what's actually going on...
On 10/7/2012 2:47 PM, Marc Perkel wrote:
Here's what I'm trying to do. I have a spam filtering operation as a front end for other servers. I've created a virtual server for spam storage where the user will be able to log in using squirrelmail/dovecot to review and release their spam. The email is stored in maildir format.
So you're trying to somewhat duplicate the functionality of a Barracuda or other AS gateway appliance, with vanilla SM and Dovecot with very little modification. Good luck with this. You're going to need to write a pretty complex shell or perl script to do most of the work, and call it from the SM "release button" routine.
Piecing it together I can use squirrelmail to pipe the email into something so that if a use finds a false positive they can hit the "release" button and the message is sent on to the recipient.
Squirrelmail sends the message as you would receive it as stored in maildir format.
SM only sends messages via SMTP submitted to the SMTP relay host specified in the config file, or via dropping to the local MTA via stdin/out. Maildir is a mail storage directory and file format protocol, not a transmission protocol. It's physically impossible to "send" a msg in maildir format, or mbox, or dbox, etc. The format of the SMTP headers and message body is plain text, possibly with MIME encoding.
So what you really mean is you need a way to read a maildir message file, scrape the recipient address, strip all of the AS headers you've inserted, drop this 'new' message to the MTA, which sends the message to the recipient. When it arrives it appears never to have been molested by your AS software, with only the proper headers and original body. Then your script needs to check the log for successful delivery (250), then send the proper commands to dovecot to log into the account as the user and delete the message. I can't begin to estimate the amount of coding and testing required here, but it will be high.
I need to take this format and translate it to send it on to the user.
Translate it? I've never used maildir, but I can't imagine the on disk message file contents need "translating". See above.
Wondering what is the best way to do that. Something that translated it into bsmtp format would be great. I'm sure thare must be something out there. I just haven't found it yet.
BSMTP isn't a file format. It's a simple Mail User Agent with some unique capabilities. Given you already have an MTA on the host, why would you need BSMTP to submit or deliver the msg? You simply need to learn the proper commands to submit mail to your local MTA. With Postfix you'd use postdrop or the sendmail compatibility command which use stdin to read the message.
My no BS assessment and recommendation are that you're likely in way over your head here (and don't realize it yet), and you need to focus your efforts on locating an integrated FOSS solution, or even a commercial solution, to fit your needs. I seem to understand better than you what is required to pull this off, and I wouldn't touch this project with a 50 ft pole. I simply don't have the coding skills for this.
-- Stan