[imp] Dynamic mailer config based on FROM and TO addresses
Michael M Slusarz
slusarz at horde.org
Thu Oct 10 21:49:17 UTC 2013
Quoting Robin Bankhead <horde at headbank.co.uk>:
> Hello,
>
> I am hoping to use Horde/Imp (latest horde-webmail from PEAR) with
> Apache James v3 (eternal beta) as IMAP server and local delivery
> agent. The local mailstore will be receiving mail from a number of
> domains/accounts, but it has no true FQDN of its own, so everything
> gets fetched into a single @localhost IMAP mailbox. That IMAP login
> is set to autologin in horde main config, and Imp uses it via
> $servers['imap']['hordeauth'] = 'full'.
>
> The James SMTP server *could* relay all outgoing mail for all these
> domains, but in my testing this has garnered high spam scores, even
> when clients are locally doing SMTP AUTH. I guess this is because
> of our lack of an originating FQDN.
>
> I'd therefore like to have Imp choose the SMTP server config
> dynamically upon sending, based on both From: and To: addresses of
> the outgoing message. The user would choose the From: address using
> a list of Identities defined in global prefs. The
>
> The things I need to know are:
>
> 1. Can this be implemented at all? (I reckon it can, but...)
Sure. But you will have to directly change the source.
> 2. Would I implement it by a routine in one of the conf files (I
> have done it like this before, for turba config circa H4) or would I
> need to use a Hook?
No.
> 3. Where do I find the variables I need for
> (a) The From: address or Identity, and
> (b) the To: address?
Just grab them from the code. You want to look at the
IMP_Compose#sendMessage() method (imp/lib/Compose.php).
$GLOBALS['injector']->getInstance('IMP_Mail') returns the mail
transport object - you will need to replace that with whatever code
you need to create the proper mailer object needed based on the
addresses.
michael
___________________________________
Michael Slusarz [slusarz at horde.org]
More information about the imp
mailing list