Qore MailMessage Module Reference 1.5
Loading...
Searching...
No Matches
MailMessage Namespace Reference

the MailMessage namespace holds all public definitions in the MailMessage module More...

Classes

class  Attachment
 class representing a MIME Attachment for the Message More...
 
hashdecl  MailMessageInfo
 Message info. More...
 
class  Message
 The Message class holds the information for a single email Message. More...
 
class  Part
 class representing a MIME part of a Message More...
 
hashdecl  PartInfo
 Message part info. More...
 

Enumerations

enum  
 Content transfer encoding for email messages and attachments. More...
 

Functions

string decode_mime_filename (string filename)
 Decodes a MIME filename that may be RFC 2231 encoded.
 
string encode_mime_filename (string filename)
 Encodes a filename for use in MIME headers according to RFC 2231.
 
string sanitize_filename (string filename)
 Sanitizes a filename to remove potentially dangerous characters.
 

Variables

const auto Encodings = ...
 a list of all known content encoding schemes encodings
 

Detailed Description

the MailMessage namespace holds all public definitions in the MailMessage module

This includes:

  • Message: wraps an email message
  • Attachment: used to attach files to a Message
  • Part: used to represent alternate representations of the message body

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Content transfer encoding for email messages and attachments.

Since
MailMessage 1.5

Function Documentation

◆ decode_mime_filename()

string MailMessage::decode_mime_filename ( string  filename)

Decodes a MIME filename that may be RFC 2231 encoded.

Parameters
filenamethe filename to decode; may be a plain filename, RFC 2231 encoded (charset'lang'value), or RFC 2047 Q/B encoded (=?charset?Q?...?= or =?charset?B?...?=)
Returns
the decoded filename
Example:
string decoded = decode_mime_filename("utf-8''%E6%96%87%E6%A1%A3.pdf");
# Returns: 文档.pdf
See also
Since
MailMessage 1.5

◆ encode_mime_filename()

string MailMessage::encode_mime_filename ( string  filename)

Encodes a filename for use in MIME headers according to RFC 2231.

Parameters
filenamethe filename to encode
Returns
the encoded filename; if the filename contains only ASCII characters that don't need encoding, returns the original filename; otherwise returns RFC 2231 encoded filename (utf-8''encoded-value)
Example:
string encoded = encode_mime_filename("文档.pdf");
# Returns: utf-8''%E6%96%87%E6%A1%A3.pdf
See also
Since
MailMessage 1.5

◆ sanitize_filename()

string MailMessage::sanitize_filename ( string  filename)

Sanitizes a filename to remove potentially dangerous characters.

Parameters
filenamethe filename to sanitize
Returns
the sanitized filename with path separators and control characters removed
Note
This function removes:
  • Path separators (/ and \)
  • Control characters (0x00-0x1f, 0x7f)
  • Leading/trailing whitespace
  • Leading dots (to prevent hidden files)
Since
MailMessage 1.5