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

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

From: Tomasz Chmielewski <mangoo_at_nospam>
Date: Tue Oct 12 2010 - 14:49:39 GMT
To: Postfix users <postfix-users@postfix.org>

On 12.10.2010 16:40, Wietse Venema wrote:
> Tomasz Chmielewski:
>> cat /samba/emails/somefile.eml | sendmail -t
>
> sendmail -t< filename

Thanks for the tip.

> assuming that the file does not contain garbage such as Control-Z
> at the end of the file.
>
> Only slightly faster would be to use one of the mini-sendmail
> programs that read a message on standard input and submit via SMTP.
>
> How do you know when the input file is complete? You should not
> start submission of a file that is still being written to.

I wanted to check with lsof if it's still opened or not.

Another option would be to only look at files which were last modified
i.e. a minute/two ago, or older than that.

An better way would be to make the client produce a file like
"somefile.eml.tmp", and when it's fully written, do a "mv/rename", which
should be atomic - but I'm not sure how the other side is flexible.

-- Tomasz Chmielewski http://wpkg.org