Quoting Michael M Slusarz <slus...@horde.org>:

Quoting Robin Bankhead <ho...@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


Thanks Michael, this saved me a lot of misdirected effort. If I may, a couple of follow-ups:

1. The "cleanest" way to attack this (least disruption to existing core code) seems like it would be to make a child to the Horde_Mail_Transport_Smtp class. Is that extra level of inheritance likely to break anything else, that you know of?

2. Would invoking by default this putative child class (call it Horde_Mail_Transport_Smtpcustom) be simply a matter of declaring $conf['mailer']['type'] = 'smtpcustom' ? The idea being I'd then not need to alter IMP_Compose::sendMessage().

3. In one scenario (mixed local and external recipients) I'd need to effectively split the message into two when sending (one for each category of recipients, going to their respective mailers). At first blush it seems like I could do this within my Smtpcustom class; do you agree, or would it
 (a) be offensively improper conduct, and/or
 (b) break things all over the place?
(I notice that IMP_Compose::buildAndSendMessage() is where this splitting happens for S/MIME multi-recipient messages, so I could probably do something there but it'd mean making my code additions less self-contained.)

Best,
Robin Bankhead
--
imp mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: imp-unsubscr...@lists.horde.org

Reply via email to