• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

kpimutils

Functions
Email Extraction Functions

Functions

bool KPIMUtils::compareEmail (const QString &email1, const QString &email2, bool matchName)
 
QByteArray KPIMUtils::extractEmailAddress (const QByteArray &address)
 
QString KPIMUtils::extractEmailAddress (const QString &address)
 
bool KPIMUtils::extractEmailAddressAndName (const QString &aStr, QString &mail, QString &name)
 
QByteArray KPIMUtils::firstEmailAddress (const QByteArray &addresses)
 
QString KPIMUtils::firstEmailAddress (const QString &addresses)
 
QString KPIMUtils::normalizedAddress (const QString &displayName, const QString &addrSpec, const QString &comment=QString())
 
QString KPIMUtils::quoteNameIfNecessary (const QString &str)
 

Detailed Description

Function Documentation

bool KPIMUtils::compareEmail ( const QString &  email1,
const QString &  email2,
bool  matchName 
)

Compare two email addresses.

If matchName is false, it just checks the email address, and returns true if this matches. If matchName is true, both the name and the email must be the same.

Parameters
email1the first email address to use for comparison
email2the second email address to use for comparison
matchNameif set to true email address and displayname must match
Returns
true if the comparison matches true in all other cases

Definition at line 918 of file email.cpp.

QByteArray KPIMUtils::extractEmailAddress ( const QByteArray &  address)

Returns the pure email address (addr-spec in RFC2822) of the given address (mailbox in RFC2822).

Parameters
addressan email address, e.g. "Joe User <joe.user@example.org>"
Returns
the addr-spec of address, i.e. joe.u.nosp@m.ser@.nosp@m.examp.nosp@m.le.o.nosp@m.rg in the example

Definition at line 674 of file email.cpp.

QString KPIMUtils::extractEmailAddress ( const QString &  address)

This is an overloaded member function, provided for convenience.

It behaves essentially like the above function.

Returns the pure email address (addr-spec in RFC2822) of the given address (mailbox in RFC2822).

Parameters
addressan email address, e.g. "Joe User <joe.user@example.org>"
Returns
the addr-spec of address, i.e. joe.u.nosp@m.ser@.nosp@m.examp.nosp@m.le.o.nosp@m.rg in the example

Definition at line 693 of file email.cpp.

bool KPIMUtils::extractEmailAddressAndName ( const QString &  aStr,
QString &  mail,
QString &  name 
)

Return email address and name from string.

Examples: "Stefan Taferner <taferner@example.org>" returns "taferner@example.org" and "Stefan Taferner". "joe@example.com" returns "joe@example.com" and "". Note that this only returns the first address.

Also note that the return value is true if both the name and the mail are not empty: this does NOT tell you if mail contains a valid email address or just some rubbish.

Parameters
aStran email address, e.g "Joe User <joe.user@example.org>"
nameonly out: returns the displayname, "Joe User" in the example
mailonly out: returns the email address "joe.user@example.org" in the example
Returns
true if both name and email address are not empty

Definition at line 724 of file email.cpp.

QByteArray KPIMUtils::firstEmailAddress ( const QByteArray &  addresses)

Returns the pure email address (addr-spec in RFC2822) of the first email address of a list of addresses.

Parameters
addressesan email address, e.g. "Joe User <joe.user@example.org>"
Returns
the addr-spec of addresses, i.e. joe.u.nosp@m.ser@.nosp@m.examp.nosp@m.le.o.nosp@m.rg in the example

Definition at line 699 of file email.cpp.

QString KPIMUtils::firstEmailAddress ( const QString &  addresses)

This is an overloaded member function, provided for convenience.

It behaves essentially like the above function.

Returns the pure email address (addr-spec in RFC2822) of the first email address of a list of addresses.

Parameters
addressesan email address, e.g. "Joe User <joe.user@example.org>"
Returns
the addr-spec of addresses, i.e. joe.u.nosp@m.ser@.nosp@m.examp.nosp@m.le.o.nosp@m.rg in the example

Definition at line 718 of file email.cpp.

QString KPIMUtils::normalizedAddress ( const QString &  displayName,
const QString &  addrSpec,
const QString &  comment = QString() 
)

Returns a normalized address built from the given parts.

The normalized address is of one the following forms:

  • displayName (comment) <addrSpec>
  • displayName <addrSpec>
  • comment <addrSpec>
  • addrSpec
Parameters
displayNamethe display name of the address
addrSpecthe actual email address (addr-spec in RFC 2822)
commenta comment
Returns
a normalized address built from the given parts

Definition at line 931 of file email.cpp.

QString KPIMUtils::quoteNameIfNecessary ( const QString &  str)

Add quote characters around the given string if it contains a character that makes that necessary, in an email name, such as ",".

Parameters
stra string that may need quoting
Returns
the string quoted if necessary

Definition at line 1088 of file email.cpp.

This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:25 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kpimutils

Skip menu "kpimutils"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal