deliver mail to two mailers?

deliver mail to two mailers?

am 03.04.2008 19:17:57 von pilsl

I'd like to know if there is a possibility within sendmail to deliver a
single mail for a certain domain to two different mailers?

Idea is that a server acts as mx-backup and therefore all mails for this
domain go to the esmtp-mailer.

But it would be very convinient if the mails goes to a second mailer
(i.e: cyrus) as well, so users can access the mail via webmail/cyrus
mailboxes as well.

When the main MX-server goes down, the MX-backupserver spools the mail
until the main-server is online again. And people can access their mails
via webinterface in the meantime. This would make sense, I guess. Last
week our mainserver was down for 5 days (server roasted on
easter-weekend) and people would have been very happy if they could have
accessed their mails that were stored on the MX-backup but unaccessible
to anyone but the sysadmin.

Can sendmail "clone" mails and deliver to two mailers?

I could write a milter that captures the mail and deliver a clone it to
the local imap-boxes, but maybe sendmail can do so as well.

thnx,
peter

Re: deliver mail to two mailers?

am 03.04.2008 19:26:53 von Andrzej Filip

peter pilsl wrote:

> I'd like to know if there is a possibility within sendmail to deliver
> a single mail for a certain domain to two different mailers?
>
> Idea is that a server acts as mx-backup and therefore all mails for
> this domain go to the esmtp-mailer.
>
> But it would be very convinient if the mails goes to a second mailer
> (i.e: cyrus) as well, so users can access the mail via webmail/cyrus
> mailboxes as well.
>
> When the main MX-server goes down, the MX-backupserver spools the mail
> until the main-server is online again. And people can access their
> mails via webinterface in the meantime. This would make sense, I
> guess. Last week our mainserver was down for 5 days (server roasted on
> easter-weekend) and people would have been very happy if they could
> have accessed their mails that were stored on the MX-backup but
> unaccessible to anyone but the sysadmin.
>
> Can sendmail "clone" mails and deliver to two mailers?

Have you considered using aliases (per every valid recipient)?
Sendmail can be also "tuned" to do aliasing also for mailers other than
local mailer.

> I could write a milter that captures the mail and deliver a clone it
> to the local imap-boxes, but maybe sendmail can do so as well.

--
[pl>en: Andrew] Andrzej Adam Filip anfi@xl.wp.pl
Open-Sendmail: http://open-sendmail.sourceforge.net/
The 11 is for people with the pride of a 10 and the pocketbook of an 8.
-- R. B. Greenberg [referring to PDPs?]

Re: deliver mail to two mailers?

am 03.04.2008 20:35:19 von pilsl

Andrzej Adam Filip wrote:
>>
>> Can sendmail "clone" mails and deliver to two mailers?
>
> Have you considered using aliases (per every valid recipient)?
> Sendmail can be also "tuned" to do aliasing also for mailers other than
> local mailer.
>

I dont use aliases on my system. A milter checks incoming mails if they
have a valid rcpt and a mailer determines the proper cyrus-box for the
rcpt and delivers via ltmp.

The valid rcpt's and corresponding mailboxes are stored in a
sql-database that is queried by the milter and the mailer.

In fact the only sendmail-conf I use is mailertable where I use three
mailers:

* procmail for listmails to mailman
* estmp for domains the server just acts as MX-backup
* goldfisch for domains hosted on the server that are handled by this
goldfisch-mailer

What I look for is a way to simply specify a domain twice in mailertable
with different mailers.

thnx
peter

Re: deliver mail to two mailers? [delivery fork: aliases or milter]

am 03.04.2008 20:44:12 von Andrzej Filip

peter pilsl wrote:

> Andrzej Adam Filip wrote:
>>>
>>> Can sendmail "clone" mails and deliver to two mailers?
>>
>> Have you considered using aliases (per every valid recipient)?
>> Sendmail can be also "tuned" to do aliasing also for mailers other than
>> local mailer.
>>
>
> I dont use aliases on my system. A milter checks incoming mails if
> they have a valid rcpt and a mailer determines the proper cyrus-box
> for the rcpt and delivers via ltmp.
>
> The valid rcpt's and corresponding mailboxes are stored in a
> sql-database that is queried by the milter and the mailer.
>
> In fact the only sendmail-conf I use is mailertable where I use three
> mailers:
>
> * procmail for listmails to mailman
> * estmp for domains the server just acts as MX-backup
> * goldfisch for domains hosted on the server that are handled by this
> goldfisch-mailer
>
> What I look for is a way to simply specify a domain twice in
> mailertable with different mailers.

AFAIK the only available ways to do "delivery fork" is sendmail are as
follows:
a) aliases
b) milter

It would be interesting to learn I have missed something :-)

--
[pl>en: Andrew] Andrzej Adam Filip anfi@xl.wp.pl
Open-Sendmail: http://open-sendmail.sourceforge.net/
There is no proverb that is not true.
-- Cervantes

Re: deliver mail to two mailers?

am 03.04.2008 21:05:05 von gtaylor

On 04/03/08 13:35, peter pilsl wrote:
> What I look for is a way to simply specify a domain twice in mailertable
> with different mailers.

Why not do something that would add an additional recipient to the
message. This recipient would then be routed to your backup mail
server. You could do something where the additional recipient was the
same user part at a different domain part, or something similar so that
Sendmail could use its standard mail routing functions. I also think
this would be more maintainable.

Another option would be to look at something like "Roundhouse" from
SnertSoft (http://www.snertsoft.com/sendmail/roundhouse/). Roundhouse
acts as your SMTP server by listening to port 25 and then forwarding
queries to your real mail server. The neat thing about Roundhouse is
that it will also send a copy of the message to another server.
Roundhouse was intended to be used for testing different mail servers,
have your main and a test server, on your live incoming SMTP traffic.
Just a thought.



Grant. . . .

Re: deliver mail to two mailers?

am 04.04.2008 15:43:48 von pilsl

Grant Taylor wrote:
> On 04/03/08 13:35, peter pilsl wrote:
>> What I look for is a way to simply specify a domain twice in
>> mailertable with different mailers.
>
> Why not do something that would add an additional recipient to the
> message. This recipient would then be routed to your backup mail
> server. You could do something where the additional recipient was the
> same user part at a different domain part, or something similar so that
> Sendmail could use its standard mail routing functions. I also think
> this would be more maintainable.
>

well ... thats smart. I guess a milter could very easily add another
recipient using smfi_addrcpt()

I like this approach more than simply save a copy to imap-box via lmtp
whatever.

On thing troubles me:

A person sends a mail to x@mydomain.com and my milter adds a second rcpt
like box_user_x@localdomain.com and then - for what reason ever -
box_user_x@localdomain.com fails. Then the sender gets a return like
"box_user_x@localdomain.com does not exist/is failing/whatever", which
looks quite suprising then, cause sender dont know about this adress at
all :)

thnx,
peter

Re: deliver mail to two mailers?

am 04.04.2008 20:39:16 von gtaylor

On 04/04/08 08:43, peter pilsl wrote:
> well ... thats smart. I guess a milter could very easily add another
> recipient using smfi_addrcpt()

*nod*

> I like this approach more than simply save a copy to imap-box via lmtp
> whatever.

Simpler is usually easier to implement and maintain.

> On thing troubles me:
>
> A person sends a mail to x@mydomain.com and my milter adds a second rcpt
> like box_user_x@localdomain.com and then - for what reason ever -
> box_user_x@localdomain.com fails. Then the sender gets a return like
> "box_user_x@localdomain.com does not exist/is failing/whatever", which
> looks quite suprising then, cause sender dont know about this adress at
> all :)

You would have to ensure that the mail box for the duplication was
accessible.

Something else you could do, not simpler, would be to add a recipient
that accepts the message and then passes it on differently. I.e. set up
a simple script that will accept the message in via STDIN and turn it in
to an message/rfc822 attachment to a new address that is the real
archive of the message. One nice thing about doing this is that you
could add some other metadata above the message/rfc822 attachment such
as the SMTP From: and SMTP To: (derived from the address for the
script). I'd send this new message from one of your own addresses to
your archive address. This way if there is a bounce, you control where
it goes.


+---+
| 1 |
+-+-+
|
|
+-+-+
| 2 |
+-+-+
| \
| \
+-+-+ +-+-+
| 3 | | 4 |
+---+ +-+-+
|
|
+-+-+
| 5 |
+---+

1) Original message from sender(s).
2) Milter adds additional recipient.
3) Original message is delivered as normal.
4) Additional recipient address that receives the message and forwards
it on.
5) Archive address that receives the message from a fixed sender address
from 4.



Grant. . . .