sptk2 logo
SPTK Home Page
Public Member Functions | Static Protected Member Functions | List of all members
sptk::BaseMailConnect Class Referenceabstract

Base mail socket. More...

#include <BaseMailConnect.h>

Inheritance diagram for sptk::BaseMailConnect:
sptk::SmtpConnect

Public Member Functions

 BaseMailConnect ()=default
 
virtual ~BaseMailConnect ()=default
 
String from () const noexcept
 
void from (const String &addr)
 
String to () const noexcept
 
void to (const String &addr)
 
String cc () const noexcept
 
void cc (const String &addr)
 
String bcc () const noexcept
 
void bcc (const String &addr)
 
String subject () const noexcept
 
void subject (const String &subj)
 
String body () const noexcept
 
void body (const String &body, bool smtp)
 Sets the current plain text part of e-mail message. More...
 
String attachments () const noexcept
 
void attachments (const String &attachments)
 
const BuffermessageBuffer () const noexcept
 
void mimeMessage (Buffer &buffer)
 
virtual void sendMessage ()=0
 

Static Protected Member Functions

static void mimeFile (const String &fileName, const String &fileAlias, std::stringstream &message)
 

Detailed Description

Base mail socket.

BaseMailConnect class is the base class for mail message components

Constructor & Destructor Documentation

◆ BaseMailConnect()

sptk::BaseMailConnect::BaseMailConnect ( )
default

Default constructor

◆ ~BaseMailConnect()

virtual sptk::BaseMailConnect::~BaseMailConnect ( )
virtualdefault

Destructor

Member Function Documentation

◆ attachments() [1/2]

String sptk::BaseMailConnect::attachments ( ) const
inlinenoexcept

Method attachments() returns the current semicolon-separated list of attachments of e-mail message. Example: "readme.txt;readme.doc".

Returns
current message list of attachments

◆ attachments() [2/2]

void sptk::BaseMailConnect::attachments ( const String attachments)
inline

Method attachments() sets the current semicolon-separated list of attachments of e-mail message. Example: "readme.txt;readme.doc".

Parameters
attachmentscurrent message list of attachments

◆ bcc() [1/2]

String sptk::BaseMailConnect::bcc ( ) const
inlinenoexcept

Method bcc() returns the current value of 'BCC:' field of e-mail message.

Returns
a list of e-mail addresses. See method to() description for format

◆ bcc() [2/2]

void sptk::BaseMailConnect::bcc ( const String addr)
inline

Method bcc() sets the current value of 'BCC:' field of e-mail message.

Parameters
addrshould be a semicolon-separated list of one or more e-mail addresses in format: Real sender name <sender@host.net>. The example: John Doe <johnd@unknown.org>

◆ body() [1/2]

String sptk::BaseMailConnect::body ( ) const
inlinenoexcept

Method subject() returns the current plain text part of e-mail message.

Returns
current message plain-text part

◆ body() [2/2]

void sptk::BaseMailConnect::body ( const String body,
bool  smtp 
)
inline

Sets the current plain text part of e-mail message.

Parameters
bodyMessage body
smtpDo we need special pre-processing for SMTP?

◆ cc() [1/2]

String sptk::BaseMailConnect::cc ( ) const
inlinenoexcept

Method cc() returns the current value of 'CC:' field of e-mail message

Returns
a list of e-mail addresses. See method to() description for format

◆ cc() [2/2]

void sptk::BaseMailConnect::cc ( const String addr)
inline

Method cc() sets the current value of 'CC:' field of e-mail message.

Parameters
addrshould be a semicolon-separated list of one or more e-mail addresses in format: Real sender name <sender@host.net>. The example: John Doe <johnd@unknown.org>

◆ from() [1/2]

String sptk::BaseMailConnect::from ( ) const
inlinenoexcept

Method from() returns the current value of 'FROM:' field of e-mail message.

Returns
a single e-mail address.

◆ from() [2/2]

void sptk::BaseMailConnect::from ( const String addr)
inline

Method from() sets the current value of 'FROM:' field of e-mail message.

Parameters
addrshould be an e-mail address in format: Real sender name <sender@host.net>. The example: John Doe <johnd@unknown.org>

◆ messageBuffer()

const Buffer & sptk::BaseMailConnect::messageBuffer ( ) const
inlinenoexcept

Method messageBuffer() returns the reference to the internal current message text completely prepared for sending, as described in RFC-822 message format. It only makes sense to use it after call to sendMessage().

Returns
reference to current message text

◆ mimeFile()

static void sptk::BaseMailConnect::mimeFile ( const String fileName,
const String fileAlias,
std::stringstream &  message 
)
staticprotected

Encoding the message into internal message buffer

◆ mimeMessage()

void sptk::BaseMailConnect::mimeMessage ( Buffer buffer)

Method mimeMessage() encodes the message components into RFC-822 message format.

Parameters
bufferA buffer to put the encoded RFC-822 format message

◆ sendMessage()

virtual void sptk::BaseMailConnect::sendMessage ( )
pure virtual

Method sendMessage() builds an RFC-822 format message out of message parameters, and sends it. Should be implemented in derived classes.

Implemented in sptk::SmtpConnect.

◆ subject() [1/2]

String sptk::BaseMailConnect::subject ( ) const
inlinenoexcept

Method subject() returns the current value of 'SUBJECT:' field of e-mail message.

Returns
current message subject

◆ subject() [2/2]

void sptk::BaseMailConnect::subject ( const String subj)
inline

Method subject() sets the current value of 'BCC:' field of e-mail message.

Parameters
subjA message subject

◆ to() [1/2]

String sptk::BaseMailConnect::to ( ) const
inlinenoexcept

Method to() returns the current value of 'TO:' field of e-mail message

◆ to() [2/2]

void sptk::BaseMailConnect::to ( const String addr)
inline

Method from() sets the current value of 'TO:' field of e-mail message.

Parameters
addrshould be a semicolon-separated list of one or more e-mail addresses in format: Real sender name <sender@host.net>. The example: John Doe <johnd@unknown.org>

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

Fri Oct 14 2022 09:58:32: SPTK 5.4.1