NAWA 0.9
Web Application Framework for C++
nawa::mail::EmailAddress Class Reference

#include <nawa/mail/EmailAddress.h>

Public Member Functions

virtual ~EmailAddress ()
 
 EmailAddress ()
 
 EmailAddress (EmailAddress const &other)
 
EmailAddressoperator= (const EmailAddress &other)
 
 EmailAddress (EmailAddress &&other) noexcept
 
EmailAddressoperator= (EmailAddress &&other) noexcept
 
 EmailAddress (std::string address)
 
 EmailAddress (std::string name, std::string address)
 
std::string & name () noexcept
 
std::string const & name () const noexcept
 
EmailAddressname (std::string value) noexcept
 
std::string & address () noexcept
 
std::string const & address () const noexcept
 
EmailAddressaddress (std::string value) noexcept
 
std::string get (bool includeName=true, bool applyPunycode=true) const
 
bool isValid () const
 

Detailed Description

Structure containing the name and email address of a recipient or sender. It contains functions for validation and getting a representation in a standard format that can be used for curl.

Definition at line 35 of file EmailAddress.h.

Constructor & Destructor Documentation

◆ ~EmailAddress()

virtual nawa::mail::EmailAddress::~EmailAddress ( )
virtual

◆ EmailAddress() [1/5]

nawa::mail::EmailAddress::EmailAddress ( )

◆ EmailAddress() [2/5]

nawa::mail::EmailAddress::EmailAddress ( EmailAddress const &  other)

◆ EmailAddress() [3/5]

nawa::mail::EmailAddress::EmailAddress ( EmailAddress &&  other)
noexcept

◆ EmailAddress() [4/5]

mail::EmailAddress::EmailAddress ( std::string  address)
explicit

Construct an EmailAddress object and initialize it with an email address.

Parameters
addressEmail address.

Definition at line 61 of file EmailAddress.cpp.

◆ EmailAddress() [5/5]

mail::EmailAddress::EmailAddress ( std::string  name,
std::string  address 
)

Construct an EmailAddress object and initialize it with a recipient (or sender) name and email address.

Parameters
nameName.
addressEmail address.

Definition at line 65 of file EmailAddress.cpp.

Member Function Documentation

◆ operator=() [1/2]

EmailAddress & nawa::mail::EmailAddress::operator= ( const EmailAddress other)

◆ operator=() [2/2]

EmailAddress & nawa::mail::EmailAddress::operator= ( EmailAddress &&  other)
noexcept

◆ name() [1/3]

std::string & nawa::mail::EmailAddress::name ( )
noexcept

The name which is part of the email address.

Returns
Reference to element.

◆ name() [2/3]

std::string const & nawa::mail::EmailAddress::name ( ) const
noexcept

◆ name() [3/3]

EmailAddress & nawa::mail::EmailAddress::name ( std::string  value)
noexcept

◆ address() [1/3]

std::string & nawa::mail::EmailAddress::address ( )
noexcept

The email address.

Returns
Reference to element.

◆ address() [2/3]

std::string const & nawa::mail::EmailAddress::address ( ) const
noexcept

◆ address() [3/3]

EmailAddress & nawa::mail::EmailAddress::address ( std::string  value)
noexcept

◆ get()

std::string mail::EmailAddress::get ( bool  includeName = true,
bool  applyPunycode = true 
) const

Get the email address in a standard representation, i.e., <john.doe\@example.com> without name, or John Doe <john.doe\@example.com> with name included.

Parameters
includeNameInclude the name in the representation (if set).
applyPunycodeConvert the domain to punycode representation, if it is an IDN.
Returns
String representation.

Definition at line 70 of file EmailAddress.cpp.

◆ isValid()

bool mail::EmailAddress::isValid ( ) const

Perform a very basic, regex-based validity check on the saved email address. This will only check that it contains an @ symbol and only valid characters before and after it, so if this function returns true, that does not necessarily mean the email address is valid. To really validate an email address, you should send a confirmation email to it. IDNs are covered by applying punycode, non-ASCII characters in the part before the '@' will make the validation fail.

Returns
True if the email address could be valid, false if it might be invalid.

Definition at line 83 of file EmailAddress.cpp.


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