|  | Home |

# QMailAddress Class Reference

The QMailAddress class provides an interface for manipulating message address strings. More...

        #include <QMailAddress>

- List of all members, including inherited members

## Public Functions

| QMailAddress ()
| QMailAddress ( const QString & addressText )
| QMailAddress ( const QString & name, const QString & address )
| ~QMailAddress ()
QString | address () const
QList<QMailAddress> | groupMembers () const
bool | isEmailAddress () const
bool | isGroup () const
bool | isNull () const
bool | isPhoneNumber () const
QString | name () const
QString | toString ( bool forceDelimited = false ) const

## Static Public Members

QList<QMailAddress> | fromStringList ( const QString & list )
QList<QMailAddress> | fromStringList ( const QStringList & list )
QString | removeComments ( const QString & input )
QString | removeWhitespace ( const QString & input )
QStringList | toStringList ( const QList<QMailAddress> & list, bool forceDelimited = false )

## Detailed Description

The QMailAddress class provides an interface for manipulating message address strings.

QMailAddress provides functions for splitting the address strings of messages into name and address components, and for combining the individual components into correctly formatted address strings. QMailAddress can be used to manipulate the address elements exposed by the QMailMessage class.

Address strings are expected to use the format "name_part '<'address_part'>'", where name_part describes a message sender or recipient and address_part defines the address at which they can be contacted. The address component is not validated, so it can contain an email address, phone number, or any other type of textual address representation.

See also QMailMessage.

## Member Function Documentation

### QMailAddress::QMailAddress ()

Constructs an empty QMailAddress object.

### QMailAddress::QMailAddress ( const QString & addressText )

Constructs a QMailAddress object, extracting the name and address components from addressText.

If addressText cannot be separated into name and address components, both name() and address() will return the entirety of addressText.

See also name() and address().

### QMailAddress::QMailAddress ( const QString & name, const QString & address )

Constructs a QMailAddress object with the given name and address.

### QMailAddress::~QMailAddress ()

Destroys a QMailAddress object.

### QString QMailAddress::address () const

Returns the address component of a mail address string.

### QList<QMailAddress> QMailAddress::fromStringList ( const QString & list ) `[static]`

Returns a list containing a QMailAddress object constructed from each comma-separated address in list.

### QList<QMailAddress> QMailAddress::fromStringList ( const QStringList & list ) `[static]`

Returns a list containing a QMailAddress object constructed from each address string in list.

### QList<QMailAddress> QMailAddress::groupMembers () const

Returns a list containing the individual addresses that comprise the address group. If the address is not a group address, an empty list is returned.

See also isGroup().

### bool QMailAddress::isEmailAddress () const

Returns true if the address component has the form of an email address; otherwise returns false.

See also isPhoneNumber().

### bool QMailAddress::isGroup () const

Returns true if the address is that of a group.

### bool QMailAddress::isNull () const

Returns true if the address object has not been initialized.

### bool QMailAddress::isPhoneNumber () const

Returns true if the address component has the form of a phone number; otherwise returns false.

See also isEmailAddress().

### QString QMailAddress::name () const

Returns the name component of a mail address string.

### QString QMailAddress::removeComments ( const QString & input ) `[static]`

Returns the content of input with any comment sections removed. Any subsequent leading or trailing whitespace is then also removed.

### QString QMailAddress::removeWhitespace ( const QString & input ) `[static]`

Returns the content of input with any whitespace characters removed. Whitespace within quotes or comment sections is preserved.

### QString QMailAddress::toString ( bool forceDelimited = false ) const

Returns a string containing the name and address in a standardised format. If forceDelimited is true, the address element will be delimited by '<' and '>', even if this is unnecessary.

### QStringList QMailAddress::toStringList ( const QList<QMailAddress> & list, bool forceDelimited = false ) `[static]`

Returns a string list containing the result of calling toString() on each address in list. If forceDelimited is true, the address elements will be delimited by '<' and '>', even if this is unnecessary.

See also toString().