KMime::Headers::Generics::AddressList Class

class KMime::Headers::Generics::AddressList

Base class for headers that deal with (possibly multiple) addresses, allowing groups. More...

Header: #include <KMime/Headers>
CMake: find_package(KPim6 REQUIRED COMPONENTS Mime)
target_link_libraries(mytarget PRIVATE KPim6::Mime)
Inherits: KMime::Headers::Generics::Structured
Inherited By:

KMime::Headers::Bcc, KMime::Headers::Cc, KMime::Headers::MailCopiesTo, KMime::Headers::ReplyTo, and KMime::Headers::To

Public Functions

void addAddress(const KMime::Types::Mailbox &mbox)
void addAddress(const QByteArray &address, const QString &displayName = QString())
QList<QByteArray> addresses() const
QStringList displayNames() const
QString displayString() const
QList<KMime::Types::Mailbox> mailboxes() const
(since 24.12) void setAddressList(const QList<KMime::Types::Address> &addresses)

Detailed Description

Note: Groups are parsed but not represented in the API yet. All addresses in groups are listed as if they would not be part of a group.

See RFC 2822, section 3.4

Member Function Documentation

void AddressList::addAddress(const KMime::Types::Mailbox &mbox)

Adds an address to this header.

mbox A Mailbox object specifying the address.

void AddressList::addAddress(const QByteArray &address, const QString &displayName = QString())

Adds an address to this header.

address The actual email address, with or without angle brackets.

displayName An optional name associated with the address.

QList<QByteArray> AddressList::addresses() const

Returns a list of all addresses in this header, regardless of groups.

QStringList AddressList::displayNames() const

Returns a list of all display names associated with the addresses in this header.

The address is added for addresses that don't have a display name.

QString AddressList::displayString() const

Returns a single string for user-facing display of this address list.

This is equivalent to displayNames().join(", ").

QList<KMime::Types::Mailbox> AddressList::mailboxes() const

Returns a list of mailboxes listed in this header.

[since 24.12] void AddressList::setAddressList(const QList<KMime::Types::Address> &addresses)

Sets the list of addresses listed in this header, replacing the existing content.

This function was introduced in 24.12.