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 [email protected] 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
182
over the counter diet pills that work best ed pills over the counter
coursework levels courseware ku coursework report coursework in marketing
coursework for high school coursework phd coursework masters coursework gcse pe
custom coursework writing coursework uitm coursework at college coursework translate
over the counter muscle relaxer antibiotic eye drops over the counter
coursework def narrative coursework examples coursework in english coursework for masters degree
coursework vs research coursework meaning in english coursework meaning in english coursework masters vs research masters
coursework degree meaning coursework resume coursework verb coursework guidelines
coursework in academic writing coursework or research coursework layout coursework writers
coursework grade boundaries coursework university coursework grade boundaries coursework for bcaba
coursework like copa nea coursework history a level coursework in english coursework hours
best over the counter diet pills antibiotic eye drops over the counter
jock itch treatment over-the-counter over the counter bladder control
п»їover the counter anxiety medication pills like viagra over the counter
corticosteroids over the counter over the counter pink eye drops
strongest over the counter muscle relaxer over the counter medicine
over the counter pill for yeast infection over the counter sinus medicine
Get here. Commonly Used Drugs Charts. ivermectin cost uk Prescription Drug Information, Interactions & Side. Learn about the side effects, dosages, and interactions.
Read information now. Cautions. ivermectin topical Best and news about drug. Best and news about drug.
Definitive journal of drugs and therapeutics. What side effects can this medication cause? https://stromectolst.com/# ivermectin 3 mg tablet dosage safe and effective drugs are available. Drugs information sheet.
drug information and news for professionals and consumers. Prescription Drug Information, Interactions & Side. [url=https://stromectolst.com/#]ivermectin buy australia[/url] Everything information about medication. drug information and news for professionals and consumers.
Medscape Drugs & Diseases. Learn about the side effects, dosages, and interactions. https://stromectolst.com/# stromectol 6 mg dosage Some are medicines that help people when doctors prescribe. Everything about medicine.
Everything what you want to know about pills. Get warning information here. stromectol tablets uk Best and news about drug. Read now.
Generic Name. Comprehensive side effect and adverse reaction information. ivermectin australia Medicament prescribing information. Everything what you want to know about pills.