the MailMessage namespace holds all public definitions in the MailMessage module
More...
|
| enum | |
| | Content transfer encoding for email messages and attachments. More...
|
| |
|
| 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.
|
| |
|
|
const auto | Encodings = ... |
| | a list of all known content encoding schemes encodings
|
| |
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
◆ anonymous enum
Content transfer encoding for email messages and attachments.
- Since
- MailMessage 1.5
◆ decode_mime_filename()
| string MailMessage::decode_mime_filename |
( |
string |
filename | ) |
|
Decodes a MIME filename that may be RFC 2231 encoded.
- Parameters
-
| filename | the 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");
- 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
-
| filename | the 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");
- See also
-
- Since
- MailMessage 1.5
◆ sanitize_filename()
| string MailMessage::sanitize_filename |
( |
string |
filename | ) |
|
Sanitizes a filename to remove potentially dangerous characters.
- Parameters
-
| filename | the 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