Setting up a catchall Email domain for testingby Group Public on Friday October 24 2008 @ 15:37:02 (1/1 Points) |
|
| Tutorial ↪User Guide ✑ Reply ✓ Stick It ✗ Ditch It ⚐ Tag It |
In order to test the reception of emails you will generally need to have an email address and POP server available. While you could get away with testing on a single address you'll discover quickly the limits that has.
Catch-All
To test with an unlimited number of email addresses you'll need to have a catch-all email domain available. Many hosting providers will provide such accounts for you. In this case you can simply use one of these for your domains. Otherwise you'll need to setup one yourself.
TestPlan Configuration
To use a catchall account you'll need to add a few configuration properties in your setup. These properties are as follows:
- Email.Pool.Host = the host where the emails can be retrieved
- Email.Pool.User = the username for the POP3 login
- Email.Pool.Pass = the password for the POP3 login
To generate random addresses that go to this account you'll also need:
- Email.Client.Prefix = a prefix to add to all generated email addresses, it can be blank
- Email.Client.Suffix = the suffix for the addresses, this should include the @ symbol and looks something like @user.com
Generate Email Address
Whenever you need a unique email address you can then just use the dynamic variable %Var:ClientEmail%.
set %TestEmail% %Var:ClientEmail% SubmitForm with %Params:Address% %TestEmail% end GetEmail %TestEmail%
Setup on Linux
On Linux you can setup a catchall domain on your own system. The only real difficulty is the domain name -- the application you're testing needs to know the destination email domain. This example here first focuses on applications running on the same machine as the test.
/etc/hosts
In the /etc/hosts file you need to add a domain where the email will be received. Let's use the domain test.local for this example. In the hosts file you need to add this to the 127.0.0.1 line.
127.0.0.1 localhost test.local
User
Use adduser to add a new user and give them a password on the system. Let's call them testmail for now, and use testmail also for the password.
To avoid problems you should forcibly create the mail directories now, either send the user an email, or use the maildirmake command, such as maildirmake Maildir
Postfix
Postfix is the system we've used for testing and is a common email provider. You'll need to have working copy of this first before proceeding. Also note these few tidbits here might not be enough to get your system working, sorry.
In your main.cf file for postfix you'll need to use regular expression virtual maps and relay domains.
virtual_maps=regexp:/etc/postfix/virtual relay_domains=$mydestination regexp:/etc/postfix/domains home_mailbox=Maildir/ #mailbox_command
mailbox_command is explicitly shown commented out to ensure that mail delivery is done to a Mailbox. In the virtual file you need to direct all mail to a domain, and all its sub-domains, to a user on the system.
# test.local whole domain to user testmail /^[^@]*@(.*\.|)test\.local$/ \testmail
In the domains file you need to get postfix to recognize all of these domains, otherwise it will complain about relaying to itself.
/(.*\.|)test\.local/ all subdomains
Then you need to postmap each file and postfix reload.
At this point you can use sendmail to test if that person receives email.
sendmail manny@test.local Hello there .
Courier POP
Simply installing the courier-pop package and its dependencies should be enough to get POP working.
Testing
Then open any mail client, configure that localhost with POP3, and you should see your email. If you don't have POP3 setup yet you can simply look in /home/testmail/Maildir/new to see if the mail arrived.
If everything is good then you can run the TestPlan sample email test (cd to the install directory first).
/opt/testplan$ testplan tests/samples/testplan_test/set_email/test_email_simple.test +`pwd`/tests/samples/testplan_test/email.properties
If you get the error javax.mail.AuthenticationFailedException: chdir Maildir failed then it is likely because the testmail user has not yet received any email. Simply send them an email with sendmail and this will be resolved.
TestPlan Setting up a catchall Email domain for testing
