public class SMimeMailer extends SmtpMailer
| Modifier and Type | Field and Description |
|---|---|
static int |
ENCRYPTED
Value for creating encrypted S/MIME messages.
|
static int |
SIGNED
Value for creating signed S/MIME messages.
|
static int |
SIGNED_AND_ENCRYPTED
Value for creating signed and encrypted S/MIME messages.
|
| Constructor and Description |
|---|
SMimeMailer(java.lang.String mailhost,
int mode)
Creates a new SMimeMailer.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAdditionalField(java.lang.String line)
Sets any additional field according to RFC822.
|
void |
addBcc(java.lang.String realName,
java.lang.String emailAddress,
X509Certificate recipientCert,
AlgorithmID keyEncAlg)
Adds one receiver (Bcc: field) of the S/MIME email message.
|
void |
addCc(java.lang.String realName,
java.lang.String emailAddress,
X509Certificate recipientCert,
AlgorithmID keyEncAlg)
Adds one receiver (Cc: field) of the S/MIME email message.
|
void |
addDate()
Sets the "Date:" field to the current date.
|
void |
addDate(java.util.Date date)
Sets the "Date:" field to the specified date.
|
void |
addTo(java.lang.String realName,
java.lang.String emailAddress,
X509Certificate recipientCert,
AlgorithmID keyEncAlg)
Adds one receiver (To: field) of the S/MIME email message.
|
boolean |
sendMail()
Encrypt and send the mail that was just created.
|
void |
setEncryption(AlgorithmID contentEncAlg,
int keyLength)
Sets the symmetric algorithm for encrypting the message.
|
void |
setFrom(java.lang.String realName,
java.lang.String emailAddress,
X509Certificate senderCert,
AlgorithmID keyEncAlg)
Sets the from field of the S/MIME email message.
|
void |
setSecureRandom(java.security.SecureRandom random)
Sets the source of randomness for the key generation.
|
java.lang.String |
toString()
Returns a string representation of this SMimeMailer.
|
addBcc, addCc, addText, addTo, checkResponse, send, sendCommands, setDebug, setFrom, setReplyTo, setSubject, setText, setVerify, writeBody, writeHeaderspublic static final int ENCRYPTED
public static final int SIGNED
public static final int SIGNED_AND_ENCRYPTED
public SMimeMailer(java.lang.String mailhost,
int mode)
mailhost - the name of the SMTP server (e.g. "mailhost.domain.com")mode - the S/MIME message mode (ENCRYPTED and/or SIGNED)public void setFrom(java.lang.String realName,
java.lang.String emailAddress,
X509Certificate senderCert,
AlgorithmID keyEncAlg)
void setFrom(String realName, String emailAddress);
from the superclass SmtpMailer.realName - the real name of the sender (e.g. "Wolfgang Platzer")emailAddress - the email address of the sender (e.g. "wplatzer@iaik.tu-graz.ac.at")senderCert - the certificate of the senderkeyEncAlg - the algorithm used to encrypt the temporary symmetric key for a receiverpublic void addTo(java.lang.String realName,
java.lang.String emailAddress,
X509Certificate recipientCert,
AlgorithmID keyEncAlg)
realName - the real name of the sender (e.g. "Wolfgang Platzer")emailAddress - the email address of the sender (e.g. "wplatzer@iaik.tu-graz.ac.at")recipientCert - the certificate of the senderkeyEncAlg - the algorithm used to encrypt the temporary symmetric key for a receiverpublic void addCc(java.lang.String realName,
java.lang.String emailAddress,
X509Certificate recipientCert,
AlgorithmID keyEncAlg)
realName - the real name of the sender (e.g. "Wolfgang Platzer")emailAddress - the email address of the sender (e.g. "wplatzer@iaik.tu-graz.ac.at")recipientCert - the certificate of the senderkeyEncAlg - the algorithm used to encrypt the temporary symmetric key for a receiverpublic void addBcc(java.lang.String realName,
java.lang.String emailAddress,
X509Certificate recipientCert,
AlgorithmID keyEncAlg)
realName - the real name of the sender (e.g. "Wolfgang Platzer")emailAddress - the email address of the sender (e.g. "wplatzer@iaik.tu-graz.ac.at")recipientCert - the certificate of the senderkeyEncAlg - the algorithm used to encrypt the temporary symmetric key for a receiverpublic void addAdditionalField(java.lang.String line)
addAdditionalField in class SmtpMailerline - a complete linepublic void addDate()
public void addDate(java.util.Date date)
date - the datepublic void setEncryption(AlgorithmID contentEncAlg, int keyLength)
Possible encryption algorithms are:
contentEncAlg - the algorithm for encrypting the contentkeyLength - the key length for RC2AlgorithmIDpublic void setSecureRandom(java.security.SecureRandom random)
random - a random number generatorpublic boolean sendMail()
throws SmtpException
sendMail in class SmtpMailerSmtpException - if there is a problem while sending the EMailSmtpMailerpublic java.lang.String toString()
toString in class SmtpMailer