On Tue, Dec 28, 2010 at 01:19:49AM -0800, email builder wrote: > I might need to learn how to write a milter that tries to divert outgoing > messages (so a smtp/client milter) that have been sent with > smtp_tls_security_level = encrypt but failed because the destination server > doesn't support STARTTLS (I understand that this is something of a false > flag, > because even successful TLS message transmission is NOT necessarily secure, > but > bear with me if you will). > > I haven't yet looked in detail at the milter API, but was wondering if I > could > ask two preliminary questions about this: > > 1) does the milter API and its placement in the server's execution provide a > place where I can determine that STARTTLS has failed?
No. Milter processing happens as mail enters the queue, delivery and STARTTLS success or failure happen when mail is leaving the queue. > (and where I can manually redirect the message and remove it from normal > processing) (milter against the STARTTLS command?) Milters process mail being received, not mail going out. > 2) does anyone know of a milter that might serve as a good example so I don't > have to start from scratch? Outgoing TLS policy failure is a non-milter problem. If you want traffic that fails mandatory TLS delivery to be re-routed for alternative processing, you can use a custom transport for mandatory tls: main.cf: indexed = ${default_database_type}:${config_directory}/ transport_maps = ${indexed}transport transport: example.com tlssmtp master.cf: tlssmtp unix - - n - - smtp -o smtp_tls_security_level=encrypt -o smtp_fallback_relay=[127.0.0.1]:12345 Note that not all failures will be starttls failures, so the fallback relay will also receive mail when the remote peer is down, or tempfails a particular recipient, ... -- Viktor.