KMime Namespace

Header: #include <KMime/Util>
CMake: find_package(KPim6 REQUIRED COMPONENTS Mime)
target_link_libraries(mytarget PRIVATE KPim6::Mime)

Namespaces

namespace HeaderParsing
namespace Headers
namespace MDN
namespace Types

Classes

class Content
class ContentIndex
class Message
class NewsArticle

Types

(since 26.04) enum CreatePolicy { DontCreate, Create }
(since 26.04) enum class NewlineType { LF, CRLF }

Functions

QByteArray CRLFtoLF(const QByteArray &s)
QByteArray LFtoCRLF(const QByteArray &s)
QList<KMime::Headers::contentEncoding> encodingsForData(QByteArrayView data)
bool hasAttachment(const KMime::Content *content)
bool hasInvitation(const KMime::Content *content)
bool isAttachment(const KMime::Content *content)
bool isCryptoPart(const KMime::Content *content)
bool isEncrypted(const KMime::Message *message)
bool isInvitation(const KMime::Content *content)
bool isSigned(const KMime::Message *message)
bool isUsAscii(QStringView s)
QByteArray multiPartBoundary()
QString nameForEncoding(KMime::Headers::contentEncoding enc)

Detailed Description

Namespaces

namespace KMime::HeaderParsing

namespace KMime::Headers

namespace KMime::MDN

namespace KMime::Types

Classes

class Content

A class that encapsulates MIME encoded Content. More...

class ContentIndex

A class to uniquely identify message parts (Content) in a hierarchy. More...

class Message

Represents a (email) message. More...

class NewsArticle

NNTP news article. More...

Type Documentation

[since 26.04] enum KMime::CreatePolicy

Controls whether to create a header that does not exist.

ConstantValueDescription
KMime::DontCreate0Do not create header
KMime::Create1Create header

This enum was introduced in 26.04.

[since 26.04] enum class KMime::NewlineType

Line endings to use.

ConstantValue
KMime::NewlineType::LF0
KMime::NewlineType::CRLF1

This enum was introduced in 26.04.

Function Documentation

QByteArray KMime::CRLFtoLF(const QByteArray &s)

Converts all occurrences of "\r\n" (CRLF) in s to "\n" (LF).

This function is expensive and should be used only if the mail will be stored locally. All decode functions can cope with both line endings.

s source string containing CRLF's

Returns the string with CRLF's substituted for LF's

See also LFtoCRLF.

QByteArray KMime::LFtoCRLF(const QByteArray &s)

Converts all occurrences of "\n" (LF) in s to "\r\n" (CRLF).

This function is expensive and should be used only if the mail will be transmitted as an RFC822 message later. All decode functions can cope with and all encode functions can optionally produce both line endings, which is much faster.

s source string containing CRLF's

Returns the string with CRLF's substituted for LF's

See also CRLFtoLF(const QByteArray&) and LFtoCRLF.

QList<KMime::Headers::contentEncoding> KMime::encodingsForData(QByteArrayView data)

Returns a list of encodings that can correctly encode the data.

data the data to check encodings for

bool KMime::hasAttachment(const KMime::Content *content)

Returns whether or not the given MIME node contains an attachment part. This function will recursively parse the MIME tree looking for a suitable attachment and return true if one is found.

content the MIME node to parse

See also isAttachment().

bool KMime::hasInvitation(const KMime::Content *content)

Returns whether or not the given MIME node contains an invitation part. This function will recursively parse the MIME tree looking for a suitable invitation and return true if one is found.

content the MIME node to parse

bool KMime::isAttachment(const KMime::Content *content)

Returns whether or not the given MIME node is an attachment part.

content the MIME node to parse

See also hasAttachment().

bool KMime::isCryptoPart(const KMime::Content *content)

Determines if the MIME part content is a crypto part.

This is, is either an encrypted part or a signature part.

bool KMime::isEncrypted(const KMime::Message *message)

Returns whether or not the given message is partly or fully encrypted.

message the message to check for being encrypted

bool KMime::isInvitation(const KMime::Content *content)

Returns whether or not the given MIME content is an invitation message of the iTIP protocol.

bool KMime::isSigned(const KMime::Message *message)

Returns whether or not the given message is partly or fully signed.

message the message to check for being signed

bool KMime::isUsAscii(QStringView s)

Checks whether s contains any non-us-ascii characters.

QByteArray KMime::multiPartBoundary()

Constructs a random string (sans leading/trailing "–") that can be used as a multipart delimiter (ie. as boundary parameter to a multipart/... content-type).

Returns the randomized string.

QString KMime::nameForEncoding(KMime::Headers::contentEncoding enc)

Returns a user-visible string for a contentEncoding, for example "quoted-printable" for CEquPr.

enc the contentEncoding to return string for TODO should they be i18n'ed?