|  | Home |

# QMailTransport Class Reference

The QMailTransport class provides a line-oriented socket for messaging communications. More...

        #include <QMailTransport>

This class is under development and is subject to change.

Inherits QObject.

- List of all members, including inherited members

## Public Types

enum | EncryptType { Encrypt_NONE, Encrypt_SSL, Encrypt_TLS }

## Public Functions

| QMailTransport ( const char * name )
qint64 | bytesSinceMark () const
bool | canReadLine () const
void | close ()
bool | connected () const
bool | inUse () const
bool | isEncrypted () const
void | mark ()
void | open ( const QString & url, int port, EncryptType encryptionType )
QByteArray | readLine ( qint64 maxSize = 0 )
QAbstractSocket & | socket ()
QDataStream & | stream ()
void | switchToEncrypted ()

- 29 public functions inherited from QObject

## Signals

void | bytesWritten ( qint64 transmitted )
void | connected ( QMailTransport::EncryptType encryptType )
void | errorOccurred ( int status, QString text )
void | readyRead ()
void | updateStatus ( const QString & status )

- 1 signal inherited from QObject

### Additional Inherited Members

- 1 property inherited from QObject
- 1 public slot inherited from QObject
- 1 public type inherited from QObject
- 4 static public members inherited from QObject
- 7 protected functions inherited from QObject
- 2 protected variables inherited from QObject

## Detailed Description

The QMailTransport class provides a line-oriented socket for messaging communications.

QMailTransport implements a TLS and SSL enabled socket, whose incoming data can be processed one line of text at a time.

QMailTransport provides the ability to count the bytes written via the socket, which is useful when data is inserted into a stream layered above the socket.

## Member Type Documentation

### enum QMailTransport::EncryptType

This enum type is used to describe the encryption types supported by the transport.

Constant | Value | Description
--- | --- | ---
`QMailTransport::Encrypt_NONE` | `0` | No encryption.
`QMailTransport::Encrypt_SSL` | `1` | Transport Layer Security encryption negotiated before application protocol connection.
`QMailTransport::Encrypt_TLS` | `2` | Transport Layer Security encryption negotiated after application protocol connection.

## Member Function Documentation

### QMailTransport::QMailTransport ( const char * name )

Creates a transport object with the supplied object name.

### qint64 QMailTransport::bytesSinceMark () const

Returns the number of bytes written since the counter as reset to zero.

See also mark().

### void QMailTransport::bytesWritten ( qint64 transmitted ) `[signal]`

This signal is emitted every time a payload of data has been written to the device. The transmitted argument is set to the number of bytes that were written in this payload.

### bool QMailTransport::canReadLine () const

Returns true if a line of data can be read from the transport; otherwise returns false.

### void QMailTransport::close ()

Closes the socket, flushing any previously unwritten data.

### bool QMailTransport::connected () const

Returns true if a connection has been established.

### void QMailTransport::connected ( QMailTransport::EncryptType encryptType ) `[signal]`

This signal is emitted when a connection is achieved, with the encryption type encryptType.

### void QMailTransport::errorOccurred ( int status, QString text ) `[signal]`

This signal is emitted when an error is encountered. The value of status corresponds to a value of QSslSocket::SocketError, and text contains a textual annotation where possible.

### bool QMailTransport::inUse () const

Returns true if the socket is connected, or in the process of connecting.

### bool QMailTransport::isEncrypted () const

Returns true if the connection is established and using encryption.

### void QMailTransport::mark ()

Resets the byte counter to zero.

See also bytesSinceMark().

### void QMailTransport::open ( const QString & url, int port, EncryptType encryptionType )

Opens a connection to the supplied url and port, using the specified encryptionType.

### QByteArray QMailTransport::readLine ( qint64 maxSize = 0 )

Reads a line from the device, but no more than maxSize characters, and returns the result as a QByteArray.

### void QMailTransport::readyRead () `[signal]`

This signal is emitted once every time new data is available for reading from the device. It will only be emitted again once new data is available, such as when a new payload of network data has arrived on your network socket, or when a new block of data has been appended to your device.

### QAbstractSocket & QMailTransport::socket ()

Returns the socket object allowing state to be accessed and manipulated.

### QDataStream & QMailTransport::stream ()

Returns the stream object allowing data to be read or written across the transport connection.

### void QMailTransport::switchToEncrypted ()

Switches the socket from unencrypted to encrypted mode.

### void QMailTransport::updateStatus ( const QString & status ) `[signal]`

This signal is emitted when a change in status is reported. The new status is described by status.