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 🙂

Categories
Uncategorized

Setting Up Email Server on your PC

If you setup an email server on your PC, you can easily send unlimited emails with a custom “From” address 🙂 This is particularly helpful if you want to send emails programmatically for some reasons (I like to send unimportant emails and small attachments via Python).

To setup a mail server on Ubuntu, just install the “postfix” package:

Now you can send emails with php, python or even by typing codes on the terminal.

It was simple. Wasn’t it?

Categories
Personal Work

My First WordPress Theme: maSnun.com gets a new look!

It’s been a really long time I have been with WordPress 🙂 I installed wordpress first on a separate sub-domain and liked the power and flexibility of WP. Later I moved the installation directly to https://masnun.com . During this period, I have switched from one theme to another. What I have looked for is simplicity and lots of customization. Obviously none of the themes could satisfy me. I have used some really great themes and appreciated their beauty in this post but all these were overkill for me. I am a simple guy and want everything to be as simple and plain as myself.

I have always wanted to do something with WordPress API by adding Google Analytics to WordPress but couldn’t really concentrate out of laziness. After my first WP plugin became a hit one, I decided to dig deeper into the WP API and then Hasin Vai asked me to study on WP Theme Development. I was looking for this. He sent me the book “WordPress 2.8 Theme Design” by Tessa Blakeley Silver. The book was good theoretically but like always, I didn’t like the idea of reading all those texts. I just skimmed through. But it gave me basics and the confidence to do something with WP Theme Development.

Today afternoon, I started building my first WordPress theme and here it is 🙂 I have built it, maSnun.com gets a new look of it’s own! 🙂 This is of course a hacked version of the famous “default” theme — Kubrick 🙂

The theme I have written has no images – plain HTML and CSS. I have willingly removed the sidebar and ability to add widgets. Instead, I have some plans to put in some static contents to fill up that space. This is just a rough version. I am not very good at CSS and styling. I am basically a developer. So my design was simply rubbish! But the positive side is I have learnt the curves of WP theme development, at least the php portion.

The efforts contributed a lot to my HTML and CSS knowledge as well. It was really a cool experience working it out!

I just love WordPress! 😀

Download: http://masnun.googlecode.com/files/masnun.com-2009-the-wp-theme.zip