Mailer
Loading...
Searching...
No Matches
EmailSender Class Reference

EmailSender class. More...

#include <email_sender.h>

Public Member Functions

 EmailSender (const std::string &smtp_server, const int smtp_port, const std::string &protocol, const std::string &from_email, const std::string &password, const std::string &from_name="")
 EmailSender constructor.
 
 ~EmailSender ()
 EmailSender destructor.
 
void setEmailContent (const std::string &subject="", const std::string &body="")
 Setter for e-mail subject and body.
 
void addRecvEmailAddr (const std::string &email_addr, const std::string &name="")
 Add e-mail receiver to receivers list.
 
void addCcEmailAddr (const std::string &email_addr, const std::string &name="")
 Add CC (copy) to the list of copy receivers.
 
void addAttachment (const std::string &filename)
 Add an attachment.
 
int send ()
 Send an e-mail.
 

Detailed Description

EmailSender class.

Constructor & Destructor Documentation

◆ EmailSender()

EmailSender::EmailSender ( const std::string & smtp_server,
const int smtp_port,
const std::string & protocol,
const std::string & from_email,
const std::string & password,
const std::string & from_name = "" )

EmailSender constructor.

Parameters
[in]smtp_serverSMTP server address
[in]smtp_portSMTP port
[in]protocolSMTP or SMTPS
[in]from_emaile-mail to send mails from (used ad SMTP authentication user name)
[in]passwordSMTP authentication password
[in]from_nameReadable name of e-mails sender

Initializing EmailSender object with all necessary parameters to send e-mails

◆ ~EmailSender()

EmailSender::~EmailSender ( )

EmailSender destructor.

Clear all lists and dispose object

Member Function Documentation

◆ addAttachment()

void EmailSender::addAttachment ( const std::string & filename)

Add an attachment.

Parameters
[in]filenameFile to attach

◆ addCcEmailAddr()

void EmailSender::addCcEmailAddr ( const std::string & email_addr,
const std::string & name = "" )

Add CC (copy) to the list of copy receivers.

Parameters
[in]email_addrE-mail address of copy receiver
[in]nameReadable name of copy receiver

◆ addRecvEmailAddr()

void EmailSender::addRecvEmailAddr ( const std::string & email_addr,
const std::string & name = "" )

Add e-mail receiver to receivers list.

Parameters
[in]email_addrReceiver's e-mail address
[in]nameReceiver's readable name

◆ send()

int EmailSender::send ( )

Send an e-mail.

Returns
status (SUCCESS, FAILURE)

Using CURL library to send e-mail

◆ setEmailContent()

void EmailSender::setEmailContent ( const std::string & subject = "",
const std::string & body = "" )

Setter for e-mail subject and body.

Parameters
[in]subjecte-mail subject
[in]bodye-mail body (can be in plain text or html format)

Applying new subject and body for e-mail


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