Categories
Python

Python: Sending a bunch of images as email attachments

Python is just beautiful! In my last post I mentioned how you can setup an email server. Now, here’s the code I use to send a bunch of images as attachments with my outgoing emails. This code snippet was taken from the Python manual. But unfortunately the code was not complete. So, I had to hack through it and configure it to suit my needs.

It currently reads the “images” directory and mails out the png files. But if you look at the codes, you’ll see that the codes can be easily changed to send other files as well 🙂

I love Python!

PS: I am looking for a good way to attach files using PHP. The way I found was messy! I know the huge PHP community certainly has something better to offer. I will post it as soon as I find it 🙂

One reply on “Python: Sending a bunch of images as email attachments”

Comments are closed.