A Tutorial to Send Email using JMeter
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.
- 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.
Hi,
I tried to send mail as above but i’m getting error as follows:
Response code: 500
Response message: Other MessagingException: javax.mail.MessagingException: Could not convert socket to TLS;
nested exception is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Response headers:
SampleResult fields:
ContentType:
DataEncoding: null
Hi Mahesh,
Try to use “Mailer Visualizer”. Use exactly same settings, you have used for SMTP Sampler and try to send a Test-Mail through Mailer-Visualizer to see if it works.
how did u clear this error in jmeter.could u help me
Hi ,
I have incorporated a simple HTTP Request sampler. Then, i am viewing the result through “View Result Tree” and writing the same results to a csv file. I want this file to send through SMTP Sampler.
Issue is, that once i execute the test-case, it sends mail first and then append new test results to the file. So, in mail i got the previous test run results instead of the new one.
Please help to incorporate this.
Thanks in advance.
Hello,
I have successfully done with sending email but i have no idea How to incorporate it with my recorded script and why it is used SMTP Sampler.
If I have more email address then how to configure it in SMTP Sampler.
Please brief me about this.
guys,
I am facing an issue I am suppose to trigger a mail from J meter (which is in NFT server) to local machine (Microsoft outlook).
So when I was trying to do that it was not happening because I was giving the SMTP server details of my local machine (Microsoft outlook).
Hi,
I tried above method for sending email from the test server but getting below error, however it was successful for gmail account. Please help us on this.
Response message: Other MessagingException: com.sun.mail.util.MailConnectException: Couldn’t connect to host, port: ——- ——- nested exception is:
java.net.ConnectException: Connection timed out: connect
I tried above method installed javax.mail.jar file also still i got this error
Response message: Other MessagingException: com.sun.mail.util.MailConnectException: Couldn’t connect to host, port: smtp.googlemail.com, 587; timeout 0;
nested exception is:
java.net.ConnectException: Connection timed out: connect
hi ,
Can I parameterise/use multiple authentications for SMTP sampler with “use auth” in a single test
Hi,
I’m getting the below error
hread Name: Thread Group 1-1
Sample Start: 2019-05-17 10:57:06 EDT
Load time: 41
Connect Time: 0
Latency: 0
Size in bytes: -1
Sent bytes:0
Headers size in bytes: 0
Body size in bytes: 0
Sample Count: 1
Error Count: 1
Data type (“text”|”bin”|””): text
Response code: 500
Response message: Unknown SMTP host: smtp.googlemail.com
SampleResult fields:
ContentType:
DataEncoding: null
hi ,
i tried above described method to configure mail .its working fine for single users.But when i am use multiple thread ,its send email for per thread .how can resolve it.
please suggest me
hi, Can anyone help me how to send email between the interval of execution of scripts.
If I run single thread with 1000 users , I need to send email on each 500 users.
Please suggest