PHTMLMailer Class
Properties Methods Events Configuration Settings Errors
The PHTMLMailer class is used to send encrypted and/or signed HTML-formatted emails with or without any attachments using OpenPGP.
Syntax
ipworksopenpgp.phtmlmailer()
Remarks
The PHTMLMailer class offers an easy-to-use interface that supports decrypting and verifying signatures of encrypted and signed emails using OpenPGP. It enables you to create messages bound for multiple recipients with different keys, simultaneously encrypt and compress with the most popular compression algorithms, and control other aspects such as the encrypting algorithm to use.
Construct the Message
To begin specify common email properties such as SendTo, Cc, BCc, Subject, and MessageText. Connection information is specified by setting MailServer and MailPort.
Encrypt
To encrypt a message specify a recipient key using the RecipientKey* properties. For instance:
PHTMLMailer1.RecipientKeyCount = 1 PHTMLMailer1.RecipientKeyKeyring(0) = "c:\my_keyring_dir" PHTMLMailer1.RecipientKeyUserId(0) = "recipient@nsoftware.com"The specified public key will be used to encrypt the message when Encrypt is called.
Sign
To sign a message specify a recipient key using the Key* properties. For instance:
PHTMLMailer1.KeyCount = 1 PHTMLMailer1.KeyKeyring(0) = "c:\my_keyring_dir" PHTMLMailer1.KeyUserId(0) = "sender@nsoftware.com" PHTMLMailer1.KeyPassphrase(0) = "password"The specified private key will be used to sign the message when Sign is called.
Sign and Encrypt
To both sign and encrypt a message call SignAndEncrypt. The message will be signed with the private keys specified in the Key* properties and encrypted with the public keys defined in the RecipientKeys* properties.
Add Attachments
To add attachments simply call AddAttachment. The ProcessAttachments setting specifies whether attachments are also encrypted and signed.
Send
Once all the appropriate properties have been set call the Send method and the message will be sent to its intended recipient(s).
Property List
The following is the full list of the properties of the class with short descriptions. Click on the links for further details.
AttachmentCount | The number of records in the Attachment arrays. |
AttachmentFile | This property contains the path of a file on your system that you would like to send as an attachment with your message. |
AttachmentName | This property contains the name of the attachment to be sent. |
AuthMechanism | Used when connecting to the mail server. |
BCc | A comma separated list of addresses for blind carbon copies (optional). |
Cc | A comma separated list of addresses for carbon copies (optional). |
Command | Used to send additional commands directly to the server. |
CompressionMethod | The compression algorithm used. |
Connected | Shows whether the class is connected. |
DeliveryNotificationTo | Email address to which to send a delivery notification. |
EncryptingAlgorithm | The encryption algorithm used when encrypting. |
FirewallAutoDetect | This property tells the class whether or not to automatically detect and use firewall system settings, if available. |
FirewallType | This property determines the type of firewall to connect through. |
FirewallHost | This property contains the name or IP address of firewall (optional). |
FirewallPassword | This property contains a password if authentication is to be used when connecting through the firewall. |
FirewallPort | This property contains the TCP port for the firewall Host . |
FirewallUser | This property contains a user name if authentication is to be used connecting through a firewall. |
From | The email address of the sender (required). |
HTMLFile | The path to a local HTML file. |
Idle | The current status of the class. |
ImageCount | The number of records in the Image arrays. |
ImageData | This property optionally specifies the image data. |
ImageFile | This property contains the name of the image files embedded into the HTML message. |
ImageId | This property contains the content identifier for embedded images. |
ImageType | This property contains the content type for embedded images. |
Importance | Importance of the mail message (optional). |
KeyCount | The number of records in the Key arrays. |
KeyEncoded | The key. |
KeyKeyring | The location of the keyring. |
KeyPassphrase | The passphrase for the key's secret key (if any). |
KeyUserId | The user Id of the key. |
LastReply | The last reply from the server. |
LocalHost | The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
MailPort | The server port for SMTP (default 25). |
MailServer | The name or address of a mail server (mail relay). |
MessageDate | Date of the mail message (optional). |
MessageHTML | The HTML version of the message. |
MessageId | The Message Identifier for the message. |
MessageRecipientCount | The number of records in the MessageRecipient arrays. |
MessageRecipientAddress | This property contains the email address of the recipient. |
MessageRecipientName | This property contains name of the recipient. |
MessageRecipientOptions | This property contains the recipient sending options (used only by SMTP). |
MessageRecipientType | This property contains the recipient type: To, Cc, or BCc. |
MessageText | The plain text version of the message. |
OtherHeaders | An RFC 822 compliant string consisting of extra headers. |
ParseHTML | Controls the behavior of the MessageHTML property. |
Password | A password for logon to the MailServer . |
Priority | Priority of the mail message (optional). |
ReadReceiptTo | Email address to send a read receipt to. |
RecipientKeyCount | The number of records in the RecipientKey arrays. |
RecipientKeyEncoded | The key. |
RecipientKeyKeyring | The location of the keyring. |
RecipientKeyUserId | The user Id of the key. |
ReplyTo | A mail address to which to reply (optional). |
SendTo | A comma separated list of addresses for destinations (required). |
Sensitivity | Sensitivity of the mail message (optional). |
SigningAlgorithm | The signature hash algorithm used when signing. |
SSLAcceptServerCertEncoded | The certificate (PEM/base64 encoded). |
SSLCertEncoded | The certificate (PEM/base64 encoded). |
SSLCertStore | The name of the certificate store for the client certificate. |
SSLCertStorePassword | If the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store. |
SSLCertStoreType | The type of certificate store for this certificate. |
SSLCertSubject | The subject of the certificate used for client authentication. |
SSLEnabled | Whether TLS/SSL is enabled. |
SSLServerCertEncoded | The certificate (PEM/base64 encoded). |
SSLStartMode | Determines how the class starts the SSL negotiation. |
Subject | The subject of the mail message (optional). |
Timeout | A timeout for the class. |
User | A user identifier to login as in the MailServer . |
Method List
The following is the full list of the methods of the class with short descriptions. Click on the links for further details.
AddAttachment | Adds FileName as an attachment. |
Config | Sets or retrieves a configuration setting. |
Connect | Connects to the mail relay and sends the SMTP HELO command. |
Disconnect | Disconnects from the SMTP server. |
DoEvents | Processes events from the internal message queue. |
Encrypt | Encrypts the message. |
Interrupt | Interrupt the current method. |
ProcessQueue | Sends the messages which have previously been queued into QueueDir . |
Queue | Queues the message into QueueDir . |
ResetHeaders | Resets all the message headers to empty. |
Send | Sends the current message and MIME encoded attachment. |
Sign | Signs the message. |
SignAndEncrypt | Signs and encrypts the current message. |
Event List
The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.
ConnectionStatus | Fired to indicate changes in connection state. |
EndTransfer | Fired when the message text completes transferring. |
Error | Information about errors during data delivery. |
KeyPassphrase | Fired if the passphrase of current key is incorrect or empty. |
PITrail | Traces the commands sent to the mail server, and the respective replies. |
Progress | Fired as progress is made. |
SSLServerAuthentication | Fired after the server presents its certificate to the client. |
SSLStatus | Shows the progress of the secure connection. |
StartTransfer | Fired when the message text starts transferring. |
Status | Shows the progress of the operation. |
Transfer | Fired while the message text gets transferred to MailServer . |
Configuration Settings
The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.
ClearSignature | Specifies whether or not to create a cleartext signature. |
Comment | The OpenPGP message comment. |
CompressionLevel | The level of compression used. |
EnsureValidDSASignatureHashAlgorithm | Whether or not to select a suitable signature hash algorithm automatically. |
LogLevel | Specifies the level of detail that is logged. |
ProcessAttachments | Whether or not to process attachments. |
SymmetricPassphrase | The password used for symmetric encryption or decryption. |
VersionHeader | The Version header value in the ASCII armored OpenPGP message. |
AttachmentEncoding[index] | Content-Transfer-Encoding for attached file (at index). |
AttachmentText[index] | Add the text into the attachment at the specified index. |
AttachmentType[index] | Content-type for attached file (at index). |
Charset | When set, the charset Content-Type attribute will be added using the specified value. |
MessageTextEncoding | When set, the MessageHTML and MessageText values will be encoded using the specified encoding. |
OverrideFilename | If set to true, the AttachmentName property value will be used to set the MIME part Filename attribute. |
TempFilePath | If set, the temporary files created during message creation will be put in the path specified. |
UseTempFile | If set, the class uses temporary files when generating messages. |
AllowEmptyTo | If set to True, then the SendTo property is not required. |
AuthorizationIdentity | The value to use as the authorization identity when SASL authentication is used. |
Charset | When set, the message headers will be encoded using the specified Charset. |
Hello | The argument for HELO (herald) command to the server (defaults to local host name). |
KeepQueue | If set to True, queued files are not deleted after a successful send. |
MaxHeaderLength | Maximum length for headers to avoid line folding (default 80). |
MessageHeadersString | String representation of RFC822-encoded headers of the message. |
MessageIdAlgorithm | Determines the algorithm used to hash the random MessageId. |
OtherHeaders | An RFC 822 compliant string consisting of extra headers. |
ReturnPath | Sets the Return-Path to be used for sending email. |
SendRSET | Whether to send RSET command. |
StopOnBccErrors | Instructs the class to stop sending the message if the server does not acknowledge any of the BCCs. |
StopOnCcErrors | Instructs the class to stop sending the message if the server does not acknowledge any of the CCs. |
StopOnToErrors | Instructs the class to stop sending the message if the server does not acknowledge any of the TOs. |
TransferText | The current portion of the message being sent. |
ConnectionTimeout | Sets a separate timeout value for establishing a connection. |
FirewallAutoDetect | Tells the class whether or not to automatically detect and use firewall system settings, if available. |
FirewallHost | Name or IP address of firewall (optional). |
FirewallPassword | Password to be used if authentication is to be used when connecting through the firewall. |
FirewallPort | The TCP port for the FirewallHost;. |
FirewallType | Determines the type of firewall to connect through. |
FirewallUser | A user name if authentication is to be used connecting through a firewall. |
KeepAliveInterval | The retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received. |
KeepAliveTime | The inactivity time in milliseconds before a TCP keep-alive packet is sent. |
Linger | When set to True, connections are terminated gracefully. |
LingerTime | Time in seconds to have the connection linger. |
LocalHost | The name of the local host through which connections are initiated or accepted. |
LocalPort | The port in the local host where the class binds. |
MaxLineLength | The maximum amount of data to accumulate when no EOL is found. |
MaxTransferRate | The transfer rate limit in bytes per second. |
ProxyExceptionsList | A semicolon separated list of hosts and IPs to bypass when using a proxy. |
TCPKeepAlive | Determines whether or not the keep alive socket option is enabled. |
TcpNoDelay | Whether or not to delay when sending packets. |
UseIPv6 | Whether to use IPv6. |
LogSSLPackets | Controls whether SSL packets are logged when using the internal security API. |
OpenSSLCADir | The path to a directory containing CA certificates. |
OpenSSLCAFile | Name of the file containing the list of CA's trusted by your application. |
OpenSSLCipherList | A string that controls the ciphers to be used by SSL. |
OpenSSLPrngSeedData | The data to seed the pseudo random number generator (PRNG). |
ReuseSSLSession | Determines if the SSL session is reused. |
SSLCACertFilePaths | The paths to CA certificate files on Unix/Linux. |
SSLCACerts | A newline separated list of CA certificate to use during SSL client authentication. |
SSLCheckCRL | Whether to check the Certificate Revocation List for the server certificate. |
SSLCipherStrength | The minimum cipher strength used for bulk encryption. |
SSLEnabledCipherSuites | The cipher suite to be used in an SSL negotiation. |
SSLEnabledProtocols | Used to enable/disable the supported security protocols. |
SSLEnableRenegotiation | Whether the renegotiation_info SSL extension is supported. |
SSLIncludeCertChain | Whether the entire certificate chain is included in the SSLServerAuthentication event. |
SSLNegotiatedCipher | Returns the negotiated ciphersuite. |
SSLNegotiatedCipherStrength | Returns the negotiated ciphersuite strength. |
SSLNegotiatedCipherSuite | Returns the negotiated ciphersuite. |
SSLNegotiatedKeyExchange | Returns the negotiated key exchange algorithm. |
SSLNegotiatedKeyExchangeStrength | Returns the negotiated key exchange algorithm strength. |
SSLNegotiatedVersion | Returns the negotiated protocol version. |
SSLProvider | The name of the security provider to use. |
SSLSecurityFlags | Flags that control certificate verification. |
SSLServerCACerts | A newline separated list of CA certificate to use during SSL server certificate validation. |
TLS12SignatureAlgorithms | Defines the allowed TLS 1.2 signature algorithms when UseInternalSecurityAPI is True. |
TLS12SupportedGroups | The supported groups for ECC. |
TLS13KeyShareGroups | The groups for which to pregenerate key shares. |
TLS13SignatureAlgorithms | The allowed certificate signature algorithms. |
TLS13SupportedGroups | The supported groups for (EC)DHE key exchange. |
AbsoluteTimeout | Determines whether timeouts are inactivity timeouts or absolute timeouts. |
FirewallData | Used to send extra data to the firewall. |
InBufferSize | The size in bytes of the incoming queue of the socket. |
OutBufferSize | The size in bytes of the outgoing queue of the socket. |
BuildInfo | Information about the product's build. |
CodePage | The system code page used for Unicode to Multibyte translations. |
LicenseInfo | Information about the current license. |
ProcessIdleEvents | Whether the class uses its internal event loop to process events when the main thread is idle. |
SelectWaitMillis | The length of time in milliseconds the class will wait when DoEvents is called if there are no events to process. |
UseInternalSecurityAPI | Tells the class whether or not to use the system security libraries or an internal implementation. |