Re: [exim] can mail be sent by dropping mail files into exim…

Top Page
Delete this message
Reply to this message
Author: Chris Lightfoot
Date:  
To: Zbigniew Szalbot
CC: exim-users
Subject: Re: [exim] can mail be sent by dropping mail files into exim queue
On Fri, May 26, 2006 at 05:04:55PM +0200, Zbigniew Szalbot wrote:
> Dear Chris,
>
> Thank you very much for your answer!
>
> On 26 May 2006 at 16:00, Chris Lightfoot wrote:
>
> > You can (I presume) do this; the format is documented in
> > the spec, e.g. here,
> >     http://www.exim.org/exim-html-4.62/doc/html/spec_html/ch52.html I
> > think that to do this safely you need to write the -D file, then write
> > the -H file under a temporary name and then rename it to its final
> > name, but I'm sure somebody will correct me if I'm wrong.

> >
> > However, this sounds like a *really dumb* idea. Instead
> > why not write the trivial program (even in PHP) to pick up
> > files your script is already writing, and then submit them
> > to Exim using SMTP. That way lies less scope for error and
> > less pain and embarrassment if/when the format changes or
> > you change MTA.
>
> Any chance you can point me to a documentation how this should be done. I have no
> problem about using SMTP but it could not be done with Mercury so that's why I assumed it
> would have to be the same process. I will appreciate further comments.


from the example you posted it looks to me as if the first
line of the mercury file is the envelope sender (preceded
by $$), the second the recipient, and the third blank.
Probably a mail to several recipients would go,

    $$sender
    recip1
    recip2
        ...
                    <-- blank line


Everything following that line appears to be an
on-the-wire (RFC[2]822) message. So, read the sender and
recipient out of the file, then connect to the mail server
(MSA strictly) on port 25, send

    HELO my.hostname.example.com


then

    MAIL FROM: <sender>


then N of,

    RCPT TO: <recipX>


then

    DATA


then the contents of the mail, with any line beginning `.'
preceded by another `.', then finally a `.' on its own.
Obviously you need to check for errors at each stage.

Of course, PHP has a built-in function for sending mail by
SMTP; it's a fertile source of security holes in
poorly-written code, but is there a good reason you
couldn't use that directly in this case?

--
``Depending on your age, you will either be singing a song about
clockwork mice who fix things, or thinking, oh my god, someone
has left Edward Heath under the grill.''
(Caitlin Moran; attrib. caption under a picture of Bagpuss)