This is mainly a reference for myself in case I forget how to do it later, as it took me a good deal of time to figure out.
Situation
I want to unit test applications that send emails. Obviously I don’t want to be opening a dozen of real email accounts just to test this thing out. Naturally I would want to install an SMTP/POP3/IMAP server on Windows, and there is one free (open source) option that is quite promising – hMailServer. However, it still involves 2 (quite major) inconveniences for my use case:
- I have to go through the configuration screens to create new users. i.e. if I want to send email to alice@localhost I’d have to create the user account alice manually
- I have to use an email client (like Outlook Express) to connect to the local POP3 server to view the emails. This seems redundant to me, since the files are already stored in my disks, why can’t I just view them?
The Solution
Then I came across exim on cygwin. exim is (as it claims to be) a vast improvement over the good ol’ sendmail. So I gave it a shot – man, that was awesome! I can now direct my application to send to arbitrary address like [email protected], [email protected] and I can view the results immediately in a text file, solving the two problems mentioned above. Here’s what I did:
- Install exim using cygwin installer
- Run
exim-config
- Edit /etc/exim.conf
- Uncomment
primary_hostname
and set it tomail.local
- Edit the router
localuser
, comment out the linecheck_local_user
(If you don’t know what that means, just search for the linelocaluser:
) - Edit %WINDIR%\system32\drivers\etc\hosts, add the line
127.0.0.1 mail.local
- Finally, reboot the exim service
And there you go! You can now send mail to *@mail.local. To view the mail, go to /var/spool/mail
which contains all the mail in text files. A simple tail -f /var/spool/mail/foobar
can monitor the mail sent to [email protected]
A simple test to make sure everything’s working:
$ exim -bt [email protected] [email protected] router = localuser, transport = local_delivery # If something is wrong in your config, it would say "Unrouteable address" # Now let's try sending an email $ exim -v -odf [email protected] Hello World! . LOG: MAIN <= [email protected] U=Chris P=local S=296 delivering KEQKED-0002RS-A7 LOG: MAIN => foobar <[email protected]> R=localuser T=local_delivery LOG: MAIN Completed # Cool, let's see if it really delivered $ tail /var/spool/mail/foobar Received: from Chris by mail.local with local (Exim 4.69) (envelope-from <[email protected]>) id KEQKED-0002RS-A7 for [email protected]; Sun, 08 Feb 2009 15:20:39 +0800 Message-Id: <[email protected]> From: Chris <[email protected]> Date: Sun, 08 Feb 2009 15:20:39 +0800 Hello World
boat accident attorney, Sol,
best attorney for car accident
car accident attorney
car Accident Attorneys
motorcycle accident attorney (Marilou)
Best Car Accident Attorneys
best attorney for Auto accident
car accident attorney (https://ahg.co.kr/bbs/board.php?bo_table=Free&wr_id=570351)
играть онлайн cat casino мобильная версия cat casino
car Accident injury attorneys
best car accident attorneys, Leoma,
Fatal Car Accident Attorney
Auto accident Attorneys near me
Car accident injury attorneys (Junepainting.com.au)
top car accident Attorney
Pretty! This has been an extremely wonderful post. Many thanks for providing this info.
Nice blog right here! Also your website quite a bit up very fast! What web host are you the usage of? Can I am getting your affiliate link on your host? I desire my web site loaded up as quickly as yours lol
Howdy, i read your blog from time to time and i own a similar one and i was just curious if you get a lot of spam comments? If so how do you prevent it, any plugin or anything you can advise? I get so much lately it’s driving me mad so any support is very much appreciated.
Why users still make use of to read news papers when in this technological world the whole thing is accessible on net?
Thank you a bunch for sharing this with all folks you really realize what you’re speaking about! Bookmarked. Kindly also visit my web site =). We will have a link exchange contract among us
When someone writes an piece of writing he/she maintains the idea of a user in his/her brain that how a user can be aware of it. So that’s why this piece of writing is great. Thanks!
Hi there! Quick question that’s completely off topic. Do you know how to make your site mobile friendly? My blog looks weird when viewing from my iphone4. I’m trying to find a template or plugin that might be able to resolve this issue. If you have any suggestions, please share. Cheers!
prescription drugs without prescription
It’s hard to come by experienced people for this subject, however, you seem like you know what you’re talking about! Thanks
canada medications
Good information. Lucky me I ran across your website by accident (stumbleupon). I have saved as a favorite for later!
Fastidious answer back in return of this difficulty with solid arguments and describing the whole thing about that.
Can you tell us more about this? I’d care to find out more details.
An impressive share! I’ve just forwarded this onto a colleague who has been doing a little research on this.
And he in fact bought me dinner because I stumbled upon it for him… lol. So let me reword this…. Thanks for the meal!! But yeah, thanx for spending the time to discuss this issue here on your web page.
I am really happy to glance at this blog posts which contains lots of helpful information, thanks for providing such data.
Hey there! Do you know if they make any plugins to assist with Search Engine Optimization? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good gains. If you know of any please share. Appreciate it!
Nice post. I learn something new and challenging on blogs I stumbleupon everyday.
It’s always useful to read through content from other writers and use something from their sites.
I absolutely love your blog.. Excellent colors & theme. Did you develop this amazing site yourself? Please reply back as I’m attempting to create my own site and would like to know where you got this from or exactly what the theme is named. Thank you!
Its like you read my mind! You seem to know a lot about this, like you wrote the book in it or something. I think that you could do with a few pics to drive the message home a little bit, but instead of that, this is wonderful blog. A fantastic read. I will definitely be back.
Fantastic beat ! I would like to apprentice while you amend your web site, how can i subscribe for a blog web site?
The account aided me a acceptable deal. I had been a little bit acquainted of this your broadcast offered bright clear idea
I have been surfing online greater than 3 hours lately, yet I never found any attention-grabbing article like yours. It’s pretty worth sufficient for me. In my opinion, if all site owners and bloggers made good content as you did, the internet will probably be much more useful than ever before.
Very rapidly this web page will be famous amid all blog viewers, due to it’s fastidious articles or reviews