Class DSN.

Inherits Garbage

The DSN class builds a bounce (a well-formed DSN message) based on a Message and other data. It's a typical single-function class: Call setMessage() and more, then call result(), then discard the DSN.

DSN::DSN()

Constructs an empty DSN message, for nothing, sent to noone, etc.

Reimplements Garbage::Garbage().

void DSN::addRecipient( Recipient * r )

Records that message() should be/was/was not delivered to r.

bool DSN::allFailed() const

Returns true if delivery to all recipients() failed, and false in any other case.

If there aren't any recipients(), this function returns true.

bool DSN::allOk() const

Returns true if all recipients() were delivered successfully, and false in any other case.

If there aren't any recipients(), this function returns true.

Recipient::Delivered, Recipient::Relayed and Recipient::Expanded are considered to indicate success.

Date * DSN::arrivalDate() const

Returns the arrival date of message(), or a null pointer if the date isn't known.

bool DSN::deliveriesPending() const

Returns true if delivery to some of the recipients() is still pending (i.e. their Recipient::action() is either Unknown or Delayed), and false if they have all been completed.

EString DSN::dsnBody() const

Computes and returns the DSN bodypart.

EString DSN::envelopeId() const

Returns the envelope-id recorded by setEnvelopeId(), or a null string if none has been recorded.

bool DSN::fullReport() const

Returns whatever setFullReport() set.

Message * DSN::message() const

Returns the value recorded by setMessage(), or a null pointer if setMessage() has not been called.

EString DSN::plainBody() const

Returns the body text for this bounce's plain-text body.

EString DSN::receivedFrom() const

Returns the name of the MTA that sent us message(), or an empty string if none did or we don't know who did.

List<Recipient> * DSN::recipients() const

Returns a list of the recipients for message(). The return value may point to an empty list, but is never a null pointer.

Injectee * DSN::result() const

Generates a multipart/report for message(), recipients() etc. and returns a pointer to the generated Message object.

If you call this twice, you get two Message objets, each generated with much effort.

Date * DSN::resultDate() const

Reports the date of the result(), or 0 if result() will use the current date and time.

Address * DSN::sender() const

Returns whatever setSender() set. If setSender() has not been called (or was called with a null pointer as argument), sender() looks for a Return-Path field in message(). If all else fails, sender() returns a null pointer.

void DSN::setArrivalDate( Date * date )

Records that message() was received at date. The initial value, null, means that the message wasn't received at any known date.

void DSN::setEnvelopeId( const EString & envid )

Records that the envelope-id (see RFC 3461) of this delivery is envid.

void DSN::setFullReport( bool full )

Records that the resulting DSN should include the entire message() if full is true, and just its top-level header if full is false. The initial value is true (this may change in a future version).

void DSN::setMessage( Message * m )

Records that the message which bounced (or was delivered) is m.

void DSN::setReceivedFrom( const EString & mta )

Records that message() was received from mta. The initial value, an empty string, means that message() was received from some unknown origin, or wasn't really received at all.

void DSN::setResultDate( Date * date )

Makes subsequent calls to result() generate a message dated date. If this function isn't called, result() uses the current date and time.

void DSN::setSender( Address * address )

Records that message() was sent by address.

bool DSN::valid() const

Returns true if this DSN object has all information it needs to construct a valid DSN, and false if not. If valid() returns false, the results of dsnBody() and message() are essentially undefined.

This web page based on source code belonging to The Archiveopteryx Developers. All rights reserved.