Test Your Setup
During the domain setup process, you’ll have the chance to verify if email sending is working for this particular domain. This happens on the API and SMTP stage of the setup wizard. It’s not compulsory but it’s certainly very helpful in detecting any potential issues.
Moments after you send an email with Mailtrap, you’ll see a response, either in your project or in the service you send emails with:
- When sending via API, you’re looking for the “200 OK” response that indicates an email was successfully dispatched.
- If you send via SMTP, the expected result is “250 2.0.0 Ok: queued as ...”
If that’s what you received, click the Verify Setup button. If all goes well, you’ll briefly see this success message:
If the timer expires and no message has been detected, you’ll see an error message:
If you received such an error, here’s what you can do:
- First of all, verify if you indeed received the desired server response. It may be easy to overlook an error and jump back to Mailtrap, eager to finalize the process.
- If you received a sending error response, check the error and try to fix it first. When in doubt, contact our support team and they’ll be happy to help you out.
If the email was sent successfully but wasn’t yet detected by Mailtrap, try the following:
- Give it some more time. The countdown lasts for two minutes but you can re-run it several times if you’d like. It’s not common, but some messages may take five minutes or more to arrive.
- If this doesn’t help, check if you have the right email sending logic coded in your project. Jump to the Testing part of Mailtrap. Copy the SMTP credentials and trigger for emails to be sent. Each message should arrive momentarily.
- If you send from your project, check if the application is bypassing email sending. For example, background jobs for sending could be stopped, or email sending could be disabled in development mode. To debug, try sending with a simple script into Mailtrap and see if this helps.
- Also verify if an email is not corrupted and has a proper syntax of headers and body. When in doubt, try sending a test message using the sample provided in Mailtrap and see if it helps.
- If you use port 587, make sure you have enabled TLS for this connection. Port 587 is encrypted by default, while other ports are open text.
- If you use any other ports, make sure that TLS is disabled and STARTTLS is enabled. Note: this doesn’t apply to port 587 as it doesn’t need STARTTLS - the transmission is encrypted the moment a connection is established.
STARTTLS is SMTP’s “switch to encrypted communication” command. It’s a universally accepted way to have TLS on the same port as open text communications. We reject all emails sent without STARTTLS (again, this doesn’t apply to port 587).
- If the issues persist, try a different port - 587 or 2525. Try to avoid port 25 as it’s often blocked by internet service providers.
If you send via API, make sure you’re using the right API key. You’ll always find it in the authorization header of the sample shown on the API and SMTP page. The API key is unique for each of your domains.
When sending via SMTP, the username is always api. The password is also shown on the API and SMTP page, in the Integrations section.
Make sure that the From: address belongs to the domain you’re currently setting up. When you go to the Sending Domains menu, you want to see five green circles next to your domain. If even one is missing, you’ll need to fix that first before you test your sending again.
Once the domain is verified, you can send from any address that belongs to it. For example, for the domain @google.com, you could use email@example.com, firstname.lastname@example.org, email@example.com, and so on.
If you wish to send from a subdomain (e.g., @sales.google.com), you’ll need to add and verify it separately.