BPS C++ API  2.24.4
BpsMail Class Reference

Mail object used for BpsSmtp. More...

#include <bpsmail.h>

Public Member Functions

void addBccRecipient (const QString &aEmail)
 Add "BCC" recipient. More...
 
void addCcRecipient (const QString &aEmail, const QString &aName=QString())
 Add a "CC" recipient. More...
 
void addFile (const QString &aFile)
 Adds a file to attach to the email. More...
 
void addImage (const QString &aFile)
 Adds an image to embedd for use in HTML. More...
 
void addToRecipient (const QString &aEmail, const QString &aName=QString())
 Add a "TO" recipient. More...
 
QStringList bccRecipients () const
 Get "BCC" recipients email addresses. More...
 
 BpsMail ()
 Constructor for the BpsMail object.
 
 BpsMail (const BpsMail &aOther)
 The copy constructor. More...
 
QList< QPair< QString, QString > > ccRecipients () const
 Get "CC" recipients email addresses and names. More...
 
void clear ()
 Clear the object to start over.
 
QStringList files () const
 
QString html () const
 
QStringList images () const
 
BpsMailoperator= (const BpsMail &aOther)
 Assign value from an other mail object. More...
 
QString senderEmail () const
 Get sender email address. More...
 
QString senderName () const
 Get sender display name. More...
 
void setBccRecipients (const QStringList &aRecipients)
 Set the list of "BCC" recipients. More...
 
void setCcRecipients (const QList< QPair< QString, QString >> &aRecipients)
 Set the list of "CC" recipients. More...
 
void setFiles (const QStringList &aFiles)
 Sets the list of files to attach to the email. More...
 
void setHtml (const QString &aHtml)
 Set the message body HTML. More...
 
void setImages (const QStringList &aFiles)
 Sets the list of images to embedd for use in HTML. More...
 
void setSender (const QString &aEmail, const QString &aName=QString())
 Set email address and name of sender. More...
 
void setSubject (const QString &aSubject)
 Set the subject. More...
 
void setText (const QString &aText)
 Set the message body text. More...
 
void setToRecipients (const QList< QPair< QString, QString >> &aRecipients)
 Set the list of "TO" recipients. More...
 
QString subject () const
 
QString text () const
 
QList< QPair< QString, QString > > toRecipients () const
 Get "TO" recipients. More...
 

Detailed Description

Mail object used for BpsSmtp.

Constructor & Destructor Documentation

◆ BpsMail()

BpsMail::BpsMail ( const BpsMail aOther)

The copy constructor.

Parameters
aOtherThe other object to copy from.

Member Function Documentation

◆ addBccRecipient()

void BpsMail::addBccRecipient ( const QString aEmail)

Add "BCC" recipient.

Parameters
aEmailThe plain email address. Example: "johndoe@sample.com".

◆ addCcRecipient()

void BpsMail::addCcRecipient ( const QString aEmail,
const QString aName = QString() 
)

Add a "CC" recipient.

Parameters
aEmailThe plain email address. Example: "johndoe@sample.com".
aNameThe optional name to be displayed. Example: "John Doe".

◆ addFile()

void BpsMail::addFile ( const QString aFile)

Adds a file to attach to the email.

The file name/path shall be given either as absolute path, or relative to the current directory.

Parameters
aFileName/oath of the file to attach.

◆ addImage()

void BpsMail::addImage ( const QString aFile)

Adds an image to embedd for use in HTML.

The first inline image is addressed as "cid:image1", the second as "cid:image2" etc.

Parameters
aFileThe image file to embedd.

◆ addToRecipient()

void BpsMail::addToRecipient ( const QString aEmail,
const QString aName = QString() 
)

Add a "TO" recipient.

Parameters
aEmailThe plain email address. Example: "johndoe@sample.com".
aNameThe optional name to be displayed. Example: "John Doe".

◆ bccRecipients()

QStringList BpsMail::bccRecipients ( ) const

Get "BCC" recipients email addresses.

The recipients are returned as a list plain email addresses.

Returns
List of "BCC" recipients.

◆ ccRecipients()

QList<QPair<QString,QString> > BpsMail::ccRecipients ( ) const

Get "CC" recipients email addresses and names.

Each recipient is returned as a list of one or two strings. The first string is the email address. If the list has two strings, the second is the display name.

Returns
List of "CC" recipients.

◆ files()

QStringList BpsMail::files ( ) const
Returns
The list of files to attach.

◆ html()

QString BpsMail::html ( ) const
Returns
The body in HTML.

◆ images()

QStringList BpsMail::images ( ) const
Returns
The list of image files to embedd.

◆ operator=()

BpsMail& BpsMail::operator= ( const BpsMail aOther)

Assign value from an other mail object.

Parameters
aOtherThe other object to copy.
Returns
Reference to the target object.

◆ senderEmail()

QString BpsMail::senderEmail ( ) const

Get sender email address.

Returns
Email address of sender.

◆ senderName()

QString BpsMail::senderName ( ) const

Get sender display name.

Returns
Display name of sender.

◆ setBccRecipients()

void BpsMail::setBccRecipients ( const QStringList aRecipients)

Set the list of "BCC" recipients.

Any previous "BCC" recipients are replaced.

Parameters
aRecipientsThe list of plain email addresses.

◆ setCcRecipients()

void BpsMail::setCcRecipients ( const QList< QPair< QString, QString >> &  aRecipients)

Set the list of "CC" recipients.

The recipients are given as a list of pairs with two strings. The first string is the email address, the second is the display name and might be empty. Any previous "CC" recipients are replaced.

Parameters
aRecipientsThe list of recipients.

◆ setFiles()

void BpsMail::setFiles ( const QStringList aFiles)

Sets the list of files to attach to the email.

Any previous list of files is replaced. The file name/path shall be given either as absolute path, or relative to the current directory.

Parameters
aFilesThe list of files to attach.

◆ setHtml()

void BpsMail::setHtml ( const QString aHtml)

Set the message body HTML.

The plain text will automatically be extracted from the given HTML. If you want to set a different plain text, call setText after setHtml.

Parameters
aHtmlThe message body HTML.

◆ setImages()

void BpsMail::setImages ( const QStringList aFiles)

Sets the list of images to embedd for use in HTML.

Any previous list of images is replaced. The first inline image is addressed as "cid:image1", the second as "cid:image2" etc.

Parameters
aFilesThe list of image files to embedd.

◆ setSender()

void BpsMail::setSender ( const QString aEmail,
const QString aName = QString() 
)

Set email address and name of sender.

Parameters
aEmailThe plain email address. Example: "johndoe@sample.com".
aNameThe sender name to be displayed. Example: "John Doe".

◆ setSubject()

void BpsMail::setSubject ( const QString aSubject)

Set the subject.

Parameters
aSubjectThe subject text.

◆ setText()

void BpsMail::setText ( const QString aText)

Set the message body text.

Parameters
aTextThe message body as plain text.

◆ setToRecipients()

void BpsMail::setToRecipients ( const QList< QPair< QString, QString >> &  aRecipients)

Set the list of "TO" recipients.

The recipients are given as a list of pairs with two strings. The first string is the email address, the second is the display name and might be empty. Any previous "TO" recipients are replaced.

Parameters
aRecipientsThe list of recipients.

◆ subject()

QString BpsMail::subject ( ) const
Returns
The subject text.

◆ text()

QString BpsMail::text ( ) const
Returns
The body as plain text.

◆ toRecipients()

QList<QPair<QString,QString> > BpsMail::toRecipients ( ) const

Get "TO" recipients.

The recipients are returned as a list of pairs with two strings. The first string is the email address, the second is the display name and might be empty.

Returns
List of "TO" recipients.

The documentation for this class was generated from the following file: