Posts Tagged "Development"

Fakemail FTW!

What is fakemail?

From the fakemail homepage:

fakemail is a fake mail server that captures emails as files for acceptance testing. This avoids the excessive configuration of setting up a real mail server and trying to extract mail queue content.

If you have had to test applications that send e-mails, for example as part of a web sign up process, you will know what an involved and tricky exercise that can be. Usually you have to sign up with a special e-mail address, have the mail go to the mail server and then read it back into the test with a POP/IMAP client. There are several downsides to this approach; you need to install extra software to interact with the POP server, you suffer from spurious failures due to reliance on external infrastructure, and it is very very slow.

Fakemail works by intercepting the mail before it leaves the machine by replacing your Mail Transfer Agent (MTA). It’s a simple script run from the command line that you can launch from within your test framework.

Why Should I Use fakemail?

The real question is why aren’t you using fakemail.  I didn’t know of fakemail before I started at SugarCRM, but now I’m glad that I do. At Sugar we use fakemail on all of our test and development instances. By using fakemail it provides a way to test all of our scripts that send emails but not actually send the emails out. What it does in turn is send the email (headers and all) to a folder specified in the config of the fakemail setup.  We happend to send ours to /tmp/<instance name>/ since we have multiple instances running on the same machine.

How do I Setup fakemail

fakemail comes in two flavors: Python and Perl. They both work the same but what this allows you to do is pick your poison on which language you are more comfortable with.

Once you install fakemail to start it up just issue the following command (PERL version)

fakemail --host=localhost --port=10025 --path=/tmp

Now it’s running. To test it out just run telnet into localhost port 10025

telnet localhost 10025
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 uno.home SMTP Net::Server::Mail (Perl) Service ready

To test it use the following commands

HELO mailer
250 Requested mail action okay, completed
MAIL From: me@here
250 sender me@here OK
RCPT To: you@there
250 recipient you@there OK
DATA
354 Start mail input; end with .

A-header: Sample header

Hello
.
250 message queued
QUIT
221 uno.home Service closing transmission channel

After this sequence we can stop the fakemail terminal with a Control-C to interrupt the process. Because we set the fakemail path to the local directory, we should see a file labelled “you@there.1″. Here is the contents of that file…

A-header: Sample header

Hello

You should now be ready to use fakemail to make your testing easier.

Don’t forget to check the fakemail page for more information.

read more

Full Open PHP Tag In JetBrains PhpStorm

A little annoyance of mine with PhpStorm is that currently there is no option to turn on auto complete for full open php tag (<?php) when you type in the short open tag (<?). 

read more

What’s in an IDE?

I’ve found myself asking that question over the past month or so.  For as long as I could remember I used Zend Studio, but recently I switch to PHPStorm from JetBrains and I’m not looking back.

read more

Zend Framework Ec2 API

So about two weeks ago Wil Sinclair from Zend pinged me about creating an Zend Framework API interface for Amazon Ec2. I was coming off of playing around with Ec2 for work and figured I would give it a shot. With the proposal filed I began the task of coding it out. After two weeks of writing code I had a working interface for the Query API from Amazon.

I do have to say I learned a lot while doing the inital work and I’m happy that Wil pinged me to do it. If you want to check out the code currently it lives on github but it is on track to make the 1.8 release of Zend Framework.

Please leave a commet here or on the proposal for anything that I may have over looked or if you have any ideas on how I could make it better.

read more

Browser Caching with Zend Framework

While watching the Zend Devzone RSS feed they posted a link to an article that talks about using the Etag Header to make ZF more cache friendly to the browser.

read more
Page 1 of 212