Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
UppHub
Status & Roadmap
FAQ
Authors & License
Forums
Funding U++
Search on this site











SourceForge.net Logo

SourceForge.net Logo

GitHub Logo

Discord Logo

InetMessage

 

struct InetMessage

This is helper class intended for parsing Pop3 (or generally, RFC822) messages. It parses messages to one or multiple (for multipart content) parts. Header names are converted to lower-case before being stored to map.

If parse is successful, InetMessage contains at least one part, with the main body and headers of message. If the body is multipart, more parts follow. Multipart part itself does not contain body. The model is recursive - parts of multipart can be multipart too. Parts contain member parent which is the index of multipart they belong to.

 

 

InetMessage::Part

 

struct Part : public Moveable<Part

This structure contains information about single part of message.

 


 

int parent

Multipart parent of this part. Part 0 has Null here indicating that there is no parent.

 


 

VectorMap<String, Stringheader

Headers. Note that keys are lowercased.

 


 

String body

Undecoded body. Empty if this is multipart.

 


 

String operator[](const char *idconst

Returns the text value of field id or empty string if missing.

 


 

String Decode() const

Returns the body of part. Bodies with transfer encoding base64 or quoted-printable are decoded. Also, if 'content-type', has 'charset' section, body is converted to application's default encoding (usually utf-8).

 

InetMessage Public Members List

 

Vector<Partpart

Message parts. If parsing (Read) was successful, there is at least part 0 present.

 


 

bool Read(const String& msg)

Attempts to parse the whole message. Returns true on success.

 


 

bool ReadHeader(const String& msg)

Attempts to parse only the message header of the first part. If succesful, there is exactly part 0 present, with empty body.

 


 

void Clear()

Clears the content (GetCount() will be 0).

 


 

int GetCount() const

Returns a number of parts present.

 


 

const Part& operator[](int iconst

Returns part[i].

 


 

String operator[](const char *idconst

Same as part[0][id] - returns the header of whole email.

 


 

String GetMessage() const

Returns InetMessage formatted according to RFC822.

 

 

Do you want to contribute?