|
Apache JMeter | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.jmeter.protocol.smtp.sampler.protocol.SendMailCommand
public class SendMailCommand
This class performs all tasks necessary to send a message (build message, prepare connection, send message). Provides getter-/setter-methods for an SmtpSampler-object to configure transport and message settings. The send-mail-command itself is started by the SmtpSampler-object.
Constructor Summary | |
---|---|
SendMailCommand()
Standard-Constructor |
Method Summary | |
---|---|
void |
addAttachment(File attachment)
Adds an attachment to current message - to be called by SmtpSampler-object |
void |
addHeader(String headerName,
String headerValue)
Adds a header-part to current HashMap of headers - to be called by SmtpSampler-object |
void |
clearAttachments()
Clear all attachments for current message |
void |
clearHeaders()
Deletes all current headers in HashMap |
void |
execute()
Processes prepareMessage() and execute() |
void |
execute(javax.mail.Message message)
Sends message to mailserver, waiting for delivery if using synchronous mode. |
List<File> |
getAttachments()
Returns all attachment for current message - standard getter |
CollectionProperty |
getHeaders()
Returns headers for current message - standard getter |
String |
getPassword()
Returns password to authenticate at the mailserver - standard getter |
List<javax.mail.internet.InternetAddress> |
getReceiverBCC()
Returns receivers of current message |
List<javax.mail.internet.InternetAddress> |
getReceiverCC()
Returns receivers of current message |
String |
getSender()
Returns sender-address for current message - standard getter |
String |
getServerResponse()
|
String |
getSmtpPort()
Returns port to be used for SMTP-connection (standard 25 or 465) - standard getter |
String |
getSmtpServer()
Returns FQDN or IP of SMTP-server to be used to send message - standard getter |
String |
getSubject()
Returns subject for current message - standard getter |
String |
getUsername()
Returns username to authenticate at the mailserver - standard getter |
boolean |
getUseSSL()
Returns if SSL is used to send message - standard getter |
boolean |
getUseStartTLS()
Returns if StartTLS is used to transmit message - standard getter |
boolean |
isEnforceStartTLS()
Returns if StartTLS is enforced to secure the connection, i.e. no fallback is used (plain SMTP) - standard getter |
boolean |
isSynchronousMode()
Returns if synchronous-mode is used for current message (i.e. time for delivery, ... is measured) - standard getter |
boolean |
isTrustAllCerts()
Returns if sampler should trust all certificates - standard getter |
boolean |
isUseAuthentication()
Returns if authentication is used to access the mailserver - standard getter |
javax.mail.Message |
prepareMessage()
Prepares message prior to be sent via execute()-method, i.e. sets properties such as protocol, authentication, etc. |
void |
setAttachments(List<File> attachments)
Adds attachments to current message |
void |
setEmlMessage(String emlMessage)
Sets eml-message to be sent |
void |
setEnableDebug(boolean selected)
|
void |
setEnforceStartTLS(boolean enforceStartTLS)
Instructs object to enforce StartTLS and not to fallback to plain SMTP-connection - to be called by SmtpSampler-object |
void |
setHeaderFields(CollectionProperty headerFields)
Sets headers for current message |
void |
setMailBody(String body)
Set the mail body. |
void |
setPassword(String password)
Sets password to authenticate at the mailserver - to be called by SmtpSampler-object |
void |
setPlainBody(boolean plainBody)
Set whether to send a plain body (i.e. not multipart/mixed) |
void |
setReceiverBCC(List<javax.mail.internet.InternetAddress> receiverBCC)
Sets receivers of current message ("bcc") - to be called by SmtpSampler-object |
void |
setReceiverCC(List<javax.mail.internet.InternetAddress> receiverCC)
Sets receivers of current message ("cc") - to be called by SmtpSampler-object |
void |
setReceiverTo(List<javax.mail.internet.InternetAddress> receiverTo)
Sets receivers of current message ("to") - to be called by SmtpSampler-object |
void |
setReplyTo(List<javax.mail.internet.InternetAddress> replyTo)
|
void |
setSender(String sender)
Sets the sender-address for the current message - to be called by SmtpSampler-object |
void |
setSmtpPort(String smtpPort)
Sets port to be used for SMTP-connection (standard 25 or 465) - to be called by SmtpSampler-object |
void |
setSmtpServer(String smtpServer)
Sets FQDN or IP of SMTP-server to be used to send message - to be called by SmtpSampler-object |
void |
setSubject(String subject)
Sets subject for current message - called by SmtpSampler-object |
void |
setSynchronousMode(boolean synchronousMode)
Sets the use of synchronous-mode (i.e. time for delivery, ... is measured) - to be called by SmtpSampler-object |
void |
setTrustAllCerts(boolean trustAllCerts)
Determines if SMTP-sampler should trust all certificates, no matter what CA - to be called by SmtpSampler-object |
void |
setTrustStoreToUse(String trustStoreToUse)
Sets the path to the local truststore to be used for SSL / StartTLS - to be called by SmtpSampler-object |
void |
setUseAuthentication(boolean useAuthentication)
Sets if authentication should be used to access the mailserver - to be called by SmtpSampler-object |
void |
setUseEmlMessage(boolean sendEmlMessage)
|
void |
setUseLocalTrustStore(boolean useLocalTrustStore)
Assigns the object to use a local truststore for SSL / StartTLS - to be called by SmtpSampler-object |
void |
setUsername(String username)
Sets username to authenticate at the mailserver - to be called by SmtpSampler-object |
void |
setUseSSL(boolean useSSL)
Sets SSL to secure the delivery channel for the message - to be called by SmtpSampler-object |
void |
setUseStartTLS(boolean useStartTLS)
Sets StartTLS to secure the delivery channel for the message - to be called by SmtpSampler-object |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SendMailCommand()
Method Detail |
---|
public javax.mail.Message prepareMessage() throws javax.mail.MessagingException, IOException
javax.mail.MessagingException
IOException
public void execute(javax.mail.Message message) throws javax.mail.MessagingException, IOException, InterruptedException
message
- Message prior prepared by prepareMessage()
javax.mail.MessagingException
IOException
InterruptedException
public void execute() throws Exception
Exception
public String getSmtpServer()
public void setSmtpServer(String smtpServer)
smtpServer
- FQDN or IP of SMTP-serverpublic String getSender()
public void setSender(String sender)
sender
- Sender-address for current messagepublic String getSubject()
public void setSubject(String subject)
subject
- Subject for message of current message - may be nullpublic String getUsername()
public void setUsername(String username)
username
- Username for mailserverpublic String getPassword()
public void setPassword(String password)
password
- Password for mailserverpublic void setReceiverTo(List<javax.mail.internet.InternetAddress> receiverTo)
receiverTo
- List of receivers public List<javax.mail.internet.InternetAddress> getReceiverCC()
public void setReceiverCC(List<javax.mail.internet.InternetAddress> receiverCC)
receiverCC
- List of receivers public List<javax.mail.internet.InternetAddress> getReceiverBCC()
public void setReceiverBCC(List<javax.mail.internet.InternetAddress> receiverBCC)
receiverBCC
- List of receivers public boolean isUseAuthentication()
public void setUseAuthentication(boolean useAuthentication)
useAuthentication
- Should authentication be used to access mailserver?public boolean getUseSSL()
public void setUseSSL(boolean useSSL)
useSSL
- Should StartTLS be used to secure SMTP-connection?public boolean getUseStartTLS()
public void setUseStartTLS(boolean useStartTLS)
useStartTLS
- Should StartTLS be used to secure SMTP-connection?public String getSmtpPort()
public void setSmtpPort(String smtpPort)
smtpPort
- Port to be used for SMTP-connectionpublic boolean isTrustAllCerts()
public void setTrustAllCerts(boolean trustAllCerts)
trustAllCerts
- Should all certificates be trusted?public void setEnforceStartTLS(boolean enforceStartTLS)
enforceStartTLS
- Should StartTLS be enforced?public boolean isEnforceStartTLS()
public CollectionProperty getHeaders()
public void setHeaderFields(CollectionProperty headerFields)
headerFields
- CollectionProperty of headers for current messagepublic void addHeader(String headerName, String headerValue)
headerName
- Key for current headerheaderValue
- Value for current headerpublic void clearHeaders()
public List<File> getAttachments()
public void setAttachments(List<File> attachments)
attachments
- List of files to be added as attachments to current messagepublic void addAttachment(File attachment)
attachment
- File-object to be added as attachment to current messagepublic void clearAttachments()
public boolean isSynchronousMode()
public void setSynchronousMode(boolean synchronousMode)
synchronousMode
- Should synchronous-mode be used?public void setUseLocalTrustStore(boolean useLocalTrustStore)
useLocalTrustStore
- Should a local truststore be used?public void setTrustStoreToUse(String trustStoreToUse)
trustStoreToUse
- Path to local truststorepublic void setUseEmlMessage(boolean sendEmlMessage)
public void setEmlMessage(String emlMessage)
emlMessage
- path to eml-messagepublic void setMailBody(String body)
body
- public void setPlainBody(boolean plainBody)
plainBody
- true
if sending a plain body (i.e. not multipart/mixed)public String getServerResponse()
public void setEnableDebug(boolean selected)
public void setReplyTo(List<javax.mail.internet.InternetAddress> replyTo)
|
Apache JMeter | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |