Sending email is a mundane activity in any professional’s life. It’s a common medium for communication nowadays. Therefore performance testing of email server is not only important but necessary for an organization. JMeter can be helpful to perform load testing in such scenarios. In this tutorial, we will see how JMeter can be used to send email.
We will use SMTP Sampler of JMeter to send an email. JavaMail API is needed to enable email functionality in JMeter. Download it from here and paste the jar in JMeter’s lib folder. Now, perform below steps to configure SMTP Sampler.
- Add a new Thread Group under Test Plan.
- Right click on Thread Group and select Add–>Sampler–>SMTP Sampler. We need to populate SMTP server’s details in this sampler.
- We will use GMail for sending an email. For this, enter these values in SMTP Sampler fields. Server: smtp.googlemail.com, Port: 587.
- Provide values in Email Address From and To fields of Mail Settings section to specify sender and recipient.
- Check ‘Use Auth’ checkbox and provide authentication details.
- Select ‘Use StartTLS’ option as GMail’s SMTP server requires that security setting.
- Provide values for email Subject and Content in Message Settings section. You can also attach an attachment from there.
- After performing all above steps, your SMTP Sampler should be displayed as below image.
Send email using JMeter
- Run your test!
After performing above steps you should be able to send email using JMeter. Oh and in case you want to know how we can receive a mail using JMeter, read it here. We hope the above examples does a good job to explain you the JMeter mail sending. In case you are stuck at some point or you know any better way to handle emails in JMeter, do let us know about it in comments.