Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have seen in some websites that lets you send a mail to an arbitraryString@mydomain.com and it still gets delivered. Note: Of course the domain name would be the same. I am sorry I don't know the correct terminology to be used in this question.

I am handling a test automation scenario for a certain website and I need to generate random email addresses for the registration process. Then I want to access that email using POP and see if the registration confirmation email is received.

So the only possibility is to run our own mail server and let all the mails to be directed to that server.

The only issue is the generation of email addresses. As 100's of test cases are run every day, we want the randomly generated email addresses to be valid, working and accessible from code.

What is this functionality called? Virtual addresses ? Aliases? And most importantly, what free/open source mail servers support this functionality?

UPDATE: I just found out about the catch all account. This sure sounds good but the issue is that emails generated from all the test cases will be directed to this email address. It would be better if I can access the received emails per email address basis.

share|improve this question
    
Why not use someFixedString+arbitraryString@mydomain.com? –  Ignacio Vazquez-Abrams Nov 22 '11 at 6:00
    
That's a good idea, but all the emails will go to the same inbox. I am trying to avoid that. But I will keep this as my last resort. Thanks :) –  Ranhiru Cooray Nov 22 '11 at 6:06
    
You mean you want the emails to be delivered to real email address, that you can subsequently access with a real email client? Then you need a real email account, not an alias or virtual account. So the answer is - any open source email server will allow the creation of 100s of email accounts. Exim + dovecot would be a good combination. –  Paul Nov 22 '11 at 6:11
    
You can still check the To header and verify the result regardless. –  Ignacio Vazquez-Abrams Nov 22 '11 at 6:18
    
@Paul: Yes. But will I be able to create those random email addresses through a programming language at run time? Or will I have to keep the addresses generated before running a test case? –  Ranhiru Cooray Nov 22 '11 at 6:25

1 Answer 1

As the requirement is to generate real mailboxes that can be accessed via pop3, a linux server may be the simplest choice.

SMTP server for incoming email: exim POP3 server for collecting emails via pop3: dovecot

Adding users on the fly can be done with

useradd -m -p <password>

Where password is pre-encrypted password, generated by the crypt() function. You could use the perl crypt() function to generate the passwords. Once the account exists on the linux box, thats all that is needed to accept emails. Tell exim you are using the Maildir format ideally, so you can monitor individual emails from the comment line in the /home/user/Maildir/ folders.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.