postfix-users October 2010 archive
Main Archive Page > Month Archives  > postfix-users archives
postfix-users: best way to send "raw" email (files)?

best way to send "raw" email (files)?

From: Tomasz Chmielewski <mangoo_at_nospam>
Date: Tue Oct 12 2010 - 11:30:30 GMT
To: postfix-users@cloud9.net

I have a legacy application which produces emails as text files (email
headers, body).

I was wondering, what would be the best way to send mails "delivered" in
such format?

Some more background:

- application is running on a Windows system,

- it writes the files to the Samba share (same server where Postfix is
running).

I was thinking of the following approach:

- check if the /samba/emails/somefile.eml is not opened already (if it
is, the application still writes to it),

- if it's not opened, do a:

cat /samba/emails/somefile.eml | sendmail -t

Is it a reasonable approach?
I'm a bit worried it's not very scalable (i.e. list the directory, run
lsof for each file, spawn cat and sendmail, and that in some kind of loop).

Critique is welcome, especially if there are better ways to deal with
"raw" email files.

-- Tomasz Chmielewski http://wpkg.org