Before you start sending emails to real users in your production environment, it’s always a good idea to start by sending test messages. You might even configure non-production environments to streamline the process of testing your emails. This gives you a safe environment to work out any kinks in your sending and how the emails look once they reach the inbox.
So how do you send test emails? Here are a few best practices to keep in mind to make testing your emails a little easier.
Test a bounce email
The most important thing to remember about testing emails is that the sending reputation of your production domain could be damaged if you’re not careful. If you send test emails from your production domain to fake addresses, or real addresses with low engagement, this can hurt the reputation of your domain and affect delivery in the future.
It’s best to test using your own domain using a non-existing email address. This way the bounces won’t negatively impact your overall sending reputation.
- You could set up a mailbox on your domain like: firstname.lastname@example.org and send all of your test emails there. Another option would be to set up a development subdomain domain like email@example.com and have all of the test messages go there instead.
- Use firstname.lastname@example.org. Using this for the recipient will send a test message that’s shown in Postmark’s Activity and Postmark will drop the message on our end. It’s also worth noting with this option that each email sent to that address will count towards your monthly limit.
Testing with the API
Postmark has a testing option you can use when sending via the API. We have a test API Token “POSTMARK_API_TEST” which you can use instead of your real API Token. This will allow you to make sure the API call you are using is valid and get a real response back. Using this method will not allow you to see the messages in your activity, nor will they get sent out, but it will tell you if your messages are being accepted. There’s also not a way to simulate a bounce with the Test API token.
Sending to multiple addresses
If your email provider supports aliases, you can use an alias of your email. For example, Gmail supports aliases so if your email address was email@example.com then you could create a new user using the + symbol for an alias, like firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, etc. Postmark will register them as different email addresses, while emails will still go to the single inbox of email@example.com.
QA testing with Tools
There are also some great tools available to help you simulate sending emails from your testing environment. Tools like MailCatcher, Mailtrap, MailHog, or MockSMTP provide a dedicated email address or locally hosted tools specifically designed to help with email in your development and test environments. When the messages are “sent” from your testing environment, you can view the full content and RAW message parts as well. This goes a long way when it comes to inspecting message content and ensuring the proper email events are triggered in your app, all without the risk of sending live emails to your customers.