Description ----------- This script provides a SMTP proxy that performs extraction of TNEF attachments and re-attaching them as normal ones. It's main purpose is provide interoperability in a mixed Windows and Linux environment. Outlook sends attachments such as winmail.dat which are unreadable by most Linux mail clients. This filter utilizes ytnef (http://ytnef.sourceforge.net/) to unpack such attachments and repackage them in a more accessible fashion. For example, meeting requests are converted to .vcf attachments which are readable by the Evolution mail client. The original TNEF (winmail.dat) attachment is kept on the message, and only additional attachments are made. This way the message is still viewable by Outlook users. One side effect is that the Outlook users will see attachments such as 'calendar.vcf' in meeting requests. This is a cost of interoperability. Caveats ------- This filter is primarily based on the PureProxy class in Python's smtpd module, and is not very robust. Messages are read whole in memory, which may be problematic for large messages. I have done tests with large messages and found no memory leaks. The filter is not designed for high volume. The filter has not been thoroughly tested. It is considered alpha quality. Requirements ------------ Python 2.3 or higher. It may work also with Python 2.2, but this is not recommended. ytnef - http://ytnef.sourceforge.net/ Setup ----- - Edit ytnef_smtpd.py and change the variables at top of script. You will need to set the local address and port to listen on, and the remote address and port to forward to. It is not recommended you use anything other than 'localhost' for the local address. If you do, be sure to firewall it off. - Start the filter as a normal user: ./ytnef_smtpd.py & The filter should not be run as root. - Configure your mail server to proxy mail through the filter. Example Setup with Postfix -------------------------- Postfix should be configured as described here: http://www.postfix.org/FILTER_README.html#advanced_filter The following assumes you will run the filter listening on port 10025 and forward to a Postfix running on 10026. This does not work in conjunction with other filters. Add to /etc/postfix/main.cf: content_filter = scan:localhost:10025 receive_override_options = no_address_mappings Then add to /etc/postfix/master.cf: scan unix - - n - 10 smtp -o smtp_send_xforward_command=yes localhost:10026 inet n - n - 10 smtpd -o content_filter= -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks -o smtpd_helo_restrictions= -o smtpd_client_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o mynetworks=127.0.0.0/8 -o smtpd_authorized_xforward_hosts=127.0.0.0/8 If you will be using this filter in conjunction with another filter such as amavisd-new, configure forwarding as follows: Postfix -> ytnef_smtpd.py -> amavisd-new -> Postfix Bugs and Suggestions -------------------- If you find any problems or have suggestions, please let me know at valankar@gmail.com.