[exim] Queue only for locally submitted messages?

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Michael J. Tubby B.Sc G8TIC
Date:  
À: Exim User List
Sujet: [exim] Queue only for locally submitted messages?
All,

I am running Exim 4.76 on Ubuntu 12.04 on a hosted server.

I have a website that generates email messages for subscriptions
(sign-ups) and other events like weekly summaries of forum posts, etc.
The website is in PHP and I was using PHP's in-built mail() function to
send messages in "sendmail -f" mode, but have recently replaced this
with an SMTP connector of my own writing for reasons which become
apparent below.

The website and email address for the webiste are in one domain while
the (shared) host is in another domain.

The Exim server is used primarily for email generated by the website but
may be used for other domains too. I am, however, in control of the Exim
configuration.

Exim deals with inbound and outbound email for the website. Inbound
email is generally bounce messages returned for outgoing messages to
subscribes that have "gone away" for some reason.

The reason that I switched to connecting to Exim via SMTP is so that I
am in full control of the email headers as well as the body. I need to
create well formed email messages and capture bounces and tie them back
to the user of the website. My PHP SMTP connector is able to create
messages with the correct "From:" and envelope-from address(es) as well
as set the "Return-Path:" correct to catch bounces. My bounce processor
(also written in PHP) parses in-bound bounce messages extracts the
message id and flags the user's email address as bouncy - this works.

The problem that I have is that my website is single-shot in-so-much-as
it generates the outgoing messages on-the-fly mixed with rendering the
HTML - I have no SMTP message queue in the website - and cannot afford
messages to be dropped either because I overwhelm Exim, if I send out a
big weekly summary or drop a membership subscription request because
Exim is busy handling a bunch of in-bound emails.

What I want to achieve is Exim running in normal delivery mode for
external traffic (in-bound) but in queue-only mode for outgoing mail
from the site. I can afford to run -q3m or -q5m to start queue runners
often, as necessary. What I can't afford is Exim to return a failure or
a defer when handling a connection from the website mail connector...

External SMTP is on port 25, local website SMTP is using mail submission
port 587 which is firewalled to be available to localhost only.

I have the following config fragments:

Main:

    daemon_smtp_port = 25:587
    return_path_remove = false
    smtp_connect_backlog = 50


My acl_smtp_rctp has:

    accept  condition = ${if eq{$interface_port}{587}{1}{0}}


at the top of it to allow messages in from website to destination that
would otherwise be rejected as "relay not permitted".


What I'm really looking for is a configuration that says:

    if received on port 587 then
        queue only
    else
        deliver normally


I guess I could try:

    domainlist relay_from_domains = mywebsite.com
    queue_domains = !+relay_from_domains


as a hack to queue everything but that which is (should be) coming back
but this seems a bit of a hack and isn't related to the connection port
(which does reflect the direction of travel).

Anyone got any ideas on how to do this? Alternatively, is there a
better way to submit a mixture of individual and bulk email in to Exim?
Can Exim be invoked to read a whole RFC2822 formatted email from stdin
or is there a "helper program" that can take an SMTP formatted message
from a file - so my website can format messages and drop them in a
directory and they can be 'consumed'?

I guess what I'm looking for is loose coupling between the website, its
generation of email messages and input to Exim.


Mike