How to send Emails with Jmeter SMTP Sampler

Reading Time: 3 minutes

Hi Folks,
Hope you are doing well !!
In this blog, we will take a look at How to send Emails with JMeter SMTP Sampler so without any delay, Let’s start

How to send Emails with Jmeter SMTP Sampler:

1) Firstly we need to download the JavaMail jar and put it into the JMeter lib folder and restart the JMeter

2) Add the Thread Group in JMeter

3) Now, Right-click on the Thread Group and Go to Add > Sampler > SMTP Sampler

4) Provide details on SMTP Sampler like

  • Server: Hostname or IP address of the server. For Gmail, the servers will be /
  • Port: Port to be used to connect to the server. Defaults are: SMTP=25, SSL=465, StartTLS=587
  • Connection timeout: Connection timeout value in milliseconds (socket level). Default is infinite timeout.
  • Read timeout: Read timeout value in milliseconds. Default is infinite timeout.
  • Address From: The from an address that will appear in the e-mail
  • Address To: The destination e-mail address (multiple values separated by “;“)

  • Use Auth: Indicates if the SMTP server requires user authentication (Sender’s email id & password)

  • Use no security features: It shows the connection to the SMTP server does not use any security protocol.
  • Enforce StartTLS: If the server does not start the TLS protocol the connection will be terminated.
  • Use SSL: Represent that the connection to the SMTP server must use the SSL protocol.
  • Use StartTLS: Indicates that the connection to the SMTP server should attempt to start the TLS protocol.
  • Finally, we need to put the message subject & message body

We can also attach files with the message.

  • Now, simply add the listener to validate the test and Run the Test

Thread Group->Add->Listener->View Results Tree

  • We can also check from Email and validate our result

  • There might be 99% chance of getting an error code 500 & a failed test because Google doesn’t allow less secure apps to access authenticated user details.
To avoid this, either use a test mail id provided by the organization or go to Google account settings->Security->Allow access to less secure apps to allow JMeter to access your account.

I hope you enjoyed it and it helped you!! stay connected to other interesting blogs

References :

Written by 

I am curious about to learn new technologies. I have good understanding of performance testing concepts.