--- /dev/null
+# tor stuff first
+#
+# if we're submitting mail *from* a .tor/.onion address,
+# make sure any header lines that may give us away is
+# stripped out, and add a new, cryptic Message-ID.
+# In address_data we store the name we should HELO as.
+tor_to_any:
+ debug_print = "R: manualroute from .onion to $local_part@$domain"
+ driver = manualroute
+ domains = ! +local_domains
+ condition = ${if match {$sender_address_domain}{\N.*\.(onion|tor)$\N}}
+ address_data = $sender_address_domain
+ transport = remote_smtp_onion
+ self = send
+ route_list = * localhost
+ headers_remove = Received:Message-ID:X-Mailer:User-Agent
+ headers_add = Message-ID: <${lc:${sha1:$message_id}}@$sender_address_domain>
+
+# this catches the case where we're submitting mail
+# from a regular email address where we don't need to
+# rewrite any headers
+any_to_tor:
+ debug_print = "R: manualroute for $local_part@$domain"
+ driver = manualroute
+ domains = ! +local_domains
+ transport = remote_smtp_onion
+ self = send
+ route_list = *.onion localhost ; *.tor localhost
+ address_data = $smtp_active_hostname
--- /dev/null
+remote_smtp_onion:
+ debug_print = "T: remote_smtp_onion for $local_part@$original_domain"
+ driver = smtp
+
+ # set helo_data to where we want to connect to,
+ # for the proxy program tor-smtp
+ helo_data = "$address_data $original_domain"
+
+ # wherever we configured our script at
+ port = 12668
+
+ # cannot use TLS otherwise it will EHLO again!!
+ hosts_avoid_tls = *