Skip to content

SMTP Sampler

Configure the JMeter SMTP Sampler samplers: properties, defaults, and practical usage notes for building reliable load tests.

Difficulty
intermediate
Guide type
reference
Estimated read time
3 min read
Last verified version
Verified JMeter 5.6

Part of the Samplers category. Also documented in context in the full Component Reference.

SMTP Sampler

The SMTP Sampler can send mail messages using SMTP/SMTPS protocol. It is possible to set security protocols for the connection (SSL and TLS), as well as user authentication. If a security protocol is used a verification on the server certificate will occur.

Two alternatives to handle this verification are available:

Trust all certificates : This will ignore certificate chain verification

Use a local truststore : With this option the certificate chain will be validated against the local truststore file.

NameRequiredDescription
ServerYesHostname or IP address of the server. See below for use with file protocol.
PortNoPort to be used to connect to the server. Defaults are: SMTP=25, SSL=465, StartTLS=587
Connection timeoutNoConnection timeout value in milliseconds (socket level). Default is infinite timeout.
Read timeoutNoRead timeout value in milliseconds (socket level). Default is infinite timeout.
Address FromYesThe from address that will appear in the e-mail
Address ToYes, unless CC or BCC is specifiedThe destination e-mail address (multiple values separated by โ€œ;โ€)
Address To CCNoCarbon copy destinations e-mail address (multiple values separated by โ€œ;โ€)
Address To BCCNoBlind carbon copy destinations e-mail address (multiple values separated by โ€œ;โ€)
Address Reply-ToNoAlternate Reply-To address (multiple values separated by โ€œ;โ€)
Use AuthNoIndicates if the SMTP server requires user authentication
UsernameNoUser login name
PasswordNoUser login password (N.B. this is stored unencrypted in the test plan)
Use no security featuresNoIndicates that the connection to the SMTP server does not use any security protocol.
Use SSLNoIndicates that the connection to the SMTP server must use the SSL protocol.
Use StartTLSNoIndicates that the connection to the SMTP server should attempt to start the TLS protocol.
Enforce StartTLSNoIf the server does not start the TLS protocol the connection will be terminated.
Trust All CertificatesNoWhen selected it will accept all certificates independent of the CA.
Use local truststoreNoWhen selected it will only accept certificates that are locally trusted.
Local truststoreNoPath to file containing the trusted certificates. Relative paths are resolved against the current directory. Failing that, against the directory containing the test script (JMX file).
Override System SSL/TLS ProtocolsNoSpecify a custom SSL/TLS protocol as space separated list to use on handshake example TLSv1 TLSv1.1 TLSv1.2. Defaults to all supported protocols.
SubjectNoThe e-mail message subject.
Suppress Subject HeaderNoIf selected, the โ€œSubject:โ€ header is omitted from the mail that is sent. This is different from sending an empty โ€œSubject:โ€ header, though some e-mail clients may display it identically.
Include timestamp in subjectNoIncludes the System.currentTimemillis() in the subject line.
Add HeaderNoAdditional headers can be defined using this button.
MessageNoThe message body.
Send plain body (i.e. not multipart/mixed)NoIf selected, then send the body as a plain message, i.e. not multipart/mixed, if possible. If the message body is empty and there is a single file, then send the file contents as the message body. :::note Note: If the message body is not empty, and there is at least one attached file, then the body is sent as multipart/mixed. :::
Attach filesNoFiles to be attached to the message.
Send .emlNoIf set, the .eml file will be sent instead of the entries in the Subject, Message, and Attach file(s) fields
Calculate message sizeNoCalculates the message size and stores it in the sample result.
Enable debug loggingNoIf set, then the โ€œmail.debugโ€ property is set to โ€œtrueโ€
On this page