|
Mailer
|
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. | |
EmailSender class.
| 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.
| [in] | smtp_server | SMTP server address |
| [in] | smtp_port | SMTP port |
| [in] | protocol | SMTP or SMTPS |
| [in] | from_email | e-mail to send mails from (used ad SMTP authentication user name) |
| [in] | password | SMTP authentication password |
| [in] | from_name | Readable name of e-mails sender |
Initializing EmailSender object with all necessary parameters to send e-mails
| EmailSender::~EmailSender | ( | ) |
EmailSender destructor.
Clear all lists and dispose object
| void EmailSender::addAttachment | ( | const std::string & | filename | ) |
Add an attachment.
| [in] | filename | File to attach |
| void EmailSender::addCcEmailAddr | ( | const std::string & | email_addr, |
| const std::string & | name = "" ) |
Add CC (copy) to the list of copy receivers.
| [in] | email_addr | E-mail address of copy receiver |
| [in] | name | Readable name of copy receiver |
| void EmailSender::addRecvEmailAddr | ( | const std::string & | email_addr, |
| const std::string & | name = "" ) |
Add e-mail receiver to receivers list.
| [in] | email_addr | Receiver's e-mail address |
| [in] | name | Receiver's readable name |
| int EmailSender::send | ( | ) |
Send an e-mail.
Using CURL library to send e-mail
| void EmailSender::setEmailContent | ( | const std::string & | subject = "", |
| const std::string & | body = "" ) |
Setter for e-mail subject and body.
| [in] | subject | e-mail subject |
| [in] | body | e-mail body (can be in plain text or html format) |
Applying new subject and body for e-mail