NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Mail delivery from Postfix to remote IMAP



I am providing family with an email address on my server. So far I deliver
their mail by forwarding it to their ISP, by using a time-honoured standard
forward.

However, thanks to the fantastic invention of DKIM and SPF and that sort
of things, that is breaking more and more.

For now I work around it by getting Postfix to deliver to the ISP's
submission port and authenticate as the recipient. I hope that this
works around DKIM, DMARC and SPF checks. See below for how this works.

But since I am impersonating them already anyway, I might as well
deliver mail directly via IMAP to their mailbox. That would presumably
be much more certain to actually arrive.

Since mails can be transferred from one IMAP server to another, I know
it is possible to inject emails into IMAP mailboxes.

But is there some convenient way already to do this from Postfix?
Everything I found so far is copying or moving from one mailbox to
another, or out of IMAP entirely.

I have a local IMAP server running as well, so I could deliver to that
and then do an IMAP-move, but that seems rather roundabout and requires
creating some service which gets somehow triggered to do this. I don't
have much space available though. A direct delivery would seem better to
me.

=======

Appendix: how to deliver mail, authenticated as the recipient, using
Postfix.

Create an entry in the /etc/postfix/transport map:

# /etc/postfix/transport
# Run postmap /etc/postfix/transport   to update
# man 5 transport
# See master.cf for smtp-isp: transports.
user%isp.tld@localhost      smtp-isp:[mail.isp.tld]:587

In main.cf, arrange to use this file:

transport_maps = hash:/etc/postfix/transport

In master.cf, set up the transport:

# Delivery method for user%isp.tld@localhost
# Triggered from transport.db
smtp-isp  unix  -       -       y       -       2       smtp
    -o syslog_name=to-isp
    -o smtp_sasl_auth_enable=yes
    -o smtp_sasl_password_maps=hash:/etc/postfix/to-isp-password
    -o smtp_sasl_security_options=

In to-isp-password:

# lhs: destination spelled the same as in transport file.
[mail.isp.tld]:587   username-as-used-at-isp:password

Update with postmap /etc/postfix/to-isp-password

You can even have different users at the same ISP, by using different
transports for them, each with their own password file.

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert                            <rhialto/at/falu.nl>
\X/ There is no AI. There is just someone else's work.           --I. Rose

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index