MFMail is a simple Python-program to mail one or more files from the command-line as a MIME-multipart message. I wrote it because I wanted to mail binary files from a shell and have them displayed in a nice way in mail-clients. (JPEG as inline images, for example)

Please mail me what you think about it. Until now, I only received a few bug-reports. I don't believe my code is almost bug-free, so please mail me. Of course I'd also like to know it if you do like my proggie ;-) You can mail me at

My SourceForge Project page is at

03-22-2001 Just a quick note that I'm still alive.
mfmail 0.6 is coming RSN(tm) (within a few months, if everything goes well ;-)
Among others, it'll be split into two modules and a main program, use Python's distutils and be available in both a .tar.gz and an RPM version.
11-17-2000 Released version 0.5.1. A one-line showstopper bugfix.
11-17-2000 Released version 0.5.0. If it breaks, use the source, mail me or wait for 0.6.0 (Which should be following soon)
8-4-2000 Released version 0.4.1
7-19-2000 Going on holiday. I probably won't have internet access for two weeks.
7-18-2000 Released version 0.4.0
This version is a complete rewrite and not well tested. I wouldn't trust my mission-critical data to it.
It probably won't eat your data and start World War III, but it may suddenly start sending obscene mails to your lover and threatening letters to the NSA ;-)


mfmail 0.5.1
mfmail 0.5.0
mfmail 0.4.1
mfmail 0.4.0
mfmail 0.3
mfmail 0.2
mfmail 0.1


mfmail foo.txt bar.jpg
tar cf - foo/ | gzip -c | mfmail application/x-gzip:remi@localhost
mfmail --from='Remi Turk ' "remi@localhost root@localhost" index.html
mfmail --cc='Remi Turk , Root ' foo.txt
cat foo.jpg | mfmail --mimetype image/jpeg remi@localhost - *.txt

Fixed a bug which made it crash when one of the config-files didn't exist.
Removed comment about security issues with mktemp(3) creating files with mode 666. tempfile.mktemp() doesn't even create files ;-)
Changed encoding support. `plain' doesn't exist anymore. You can now choose between `7bit', `8bit', `binary', `base64' and `quoted-printable'.
Changed global config variables and the MailOptions into global static GeneralOptions and MailOptions classes.
Added --debug option (which isn't ready for primetime yet)
Added `addressbook'-section in ~/.mfmailrc
Switched read_config_file() from just calling fail() to exceptions.
Added code to detect duplicate sections/variables in the configuration file.
Changed a lot of out of date comments.
Added a FAQ. (Probably not very useful yet)
Previously, after creating the whole message, a pipe was setup to a sendmail process and the message was written to it. Now, sendmail is called with it's stdin connected to the file, which makes it more efficient. (We don't copy the entire file through the pipe)
Complete rewrite
Lots of things not mentioned below.
Added options for encoding
Removed a few statements with made it fail with older Python versions.
Extended the options you can use in the config-file
Made a lot of backward incompatible changes.
Removed special-case for no-files-specified. (IOW: If you don't specify any files on the commandline, you'll get an error)
Multiple -f/--from flags now override each other. A -f/--from option overrides the default from the config-file too. (-c/--cc has the semantics of -f/--from, multiple -b/--bcc options are still concatenated.