#include <inetmail.h>
Inheritance diagram for PRFC822Channel:
Public Types | |
enum | Direction { Sending, Receiving } |
Public Member Functions | |
PRFC822Channel (Direction direction) | |
~PRFC822Channel () | |
BOOL | Close () |
virtual BOOL | Write (const void *buf, PINDEX len) |
void | NewMessage (Direction direction) |
PString | MultipartMessage () |
BOOL | MultipartMessage (const PString &boundary) |
void | NextPart (const PString &boundary) |
void | SetFromAddress (const PString &fromAddress) |
void | SetToAddress (const PString &toAddress) |
void | SetCC (const PString &ccAddress) |
void | SetBCC (const PString &bccAddress) |
void | SetSubject (const PString &subject) |
void | SetContentType (const PString &contentType) |
void | SetContentAttachment (const PFilePath &filename) |
void | SetTransferEncoding (const PString &encoding, BOOL autoTranslate=TRUE) |
void | SetHeaderField (const PString &name, const PString &value) |
BOOL | SendWithSMTP (const PString &hostname) |
BOOL | SendWithSMTP (PSMTPClient *smtp) |
Static Public Attributes | |
const char | MimeVersionTag [] |
const char | FromTag [] |
const char | ToTag [] |
const char | CCTag [] |
const char | BCCTag [] |
const char | SubjectTag [] |
const char | DateTag [] |
const char | ReturnPathTag [] |
const char | ReceivedTag [] |
const char | MessageIDTag [] |
const char | MailerTag [] |
const char | ContentTypeTag [] |
const char | ContentDispositionTag [] |
const char | ContentTransferEncodingTag [] |
Protected Member Functions | |
BOOL | OnOpen () |
Protected Attributes | |
BOOL | writeHeaders |
PMIMEInfo | headers |
BOOL | writePartHeaders |
PMIMEInfo | partHeaders |
PStringList | boundaries |
PBase64 * | base64 |
PSMTPClient mail("mailserver");
if (mail.IsOpen()) {
PRFC822Channel message;
message.SetFromAddress("Me@here.com.au");
message.SetToAddress("Fred@somwhere.com");
if (message.Open(mail)) {
if (mail.BeginMessage("Me@here.com.au", "Fred@somwhere.com")) {
if (!message.Write(myMessageBody))
PError << "Mail write failed." << endl;
if (!message.EndMessage())
PError << "Mail send failed." << endl;
}
}
}
else
PError << "Mail conection failed." << endl;
|
|
|
Construct a RFC822 aware channel.
|
|
Close the channel before destruction. |
|
Close the channel. This assures that all mime fields etc are closed off before closing the underliying channel. Reimplemented from PIndirectChannel. |
|
Enter multipart MIME message mode. This indicates that the message, or individual part within a message as MIME is nestable, is a multipart message. In this form the user supplies a boundary indicator string which must then be used in all subsequent NextPart() calls. Note this must be called before any writes are done to the message or part. |
|
Enter multipart MIME message mode. This indicates that the message, or individual part within a message as MIME is nestable, is a multipart message. This form returns the boundary indicator string generated internally which must then be used in all subsequent NextPart() calls. Note this must be called before any writes are done to the message or part. |
|
Begin a new message. This may be used if the object is to encode 2 or more messages sequentially. It resets the internal state of the object.
|
|
Indicate that a new multipart message part is to begin. This will close off the previous part, and any nested multipart messages contained therein, and allow a new part to begin. The user may adjust the parts content type and other header fields after this call and before the first write of the parts body. The default Content-Type is "text/plain". Note that all header fields are cleared from the previous part. |
|
This callback is executed when the Open() function is called with open channels. It may be used by descendent channels to do any handshaking required by the protocol that channel embodies. The default behaviour is to simply return TRUE.
Reimplemented from PIndirectChannel. |
|
Send this message using an SMTP socket. This assumes PSMTPClient is open the sends the message to the remote SMTP server. |
|
Send this message using an SMTP socket. This will create a PSMTPClient and connect to the specified host then send the message to the remote SMTP server. |
|
Set the Blind Carbon Copy address(es). This must be called before any writes are done to the channel.
|
|
Set the Carbon Copy address(es). This must be called before any writes are done to the channel.
|
|
Set the content disposition for attachments. This must be called before any writes are done to the channel. It may be set again immediately after any call to NextPart() when multipart mime is being used. Note that this will alter the Content-Type field to
|
|
Set the content type. This must be called before any writes are done to the channel. It may be set again immediately after any call to NextPart() when multipart mime is being used. The default Content-Type is "text/plain".
|
|
Set the sender address. This must be called before any writes are done to the channel.
|
|
Set the and arbitrary header field. This must be called before any writes are done to the channel.
|
|
Set the message subject. This must be called before any writes are done to the channel.
|
|
Set the recipient address(es). This must be called before any writes are done to the channel.
|
|
Set the content transfer encoding. This must be called before any writes are done to the channel. It may be set again immediately after any call to NextPart() when multipart mime is being used. If the encoding is "base64" (case insensitive) and , all writes will be treated as binary and translated into base64 encoding before output to the underlying channel.
|
|
Low level write to the channel. This override assures that the header is written before the body that will be output via this function.
Reimplemented from PIndirectChannel. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|