#include <nawa/mail/EmailAddress.h>
Public Member Functions | |
virtual | ~EmailAddress () |
EmailAddress () | |
EmailAddress (EmailAddress const &other) | |
EmailAddress & | operator= (const EmailAddress &other) |
EmailAddress (EmailAddress &&other) noexcept | |
EmailAddress & | operator= (EmailAddress &&other) noexcept |
EmailAddress (std::string address) | |
EmailAddress (std::string name, std::string address) | |
std::string & | name () noexcept |
std::string const & | name () const noexcept |
EmailAddress & | name (std::string value) noexcept |
std::string & | address () noexcept |
std::string const & | address () const noexcept |
EmailAddress & | address (std::string value) noexcept |
std::string | get (bool includeName=true, bool applyPunycode=true) const |
bool | isValid () const |
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.
|
virtual |
nawa::mail::EmailAddress::EmailAddress | ( | ) |
nawa::mail::EmailAddress::EmailAddress | ( | EmailAddress const & | other | ) |
|
noexcept |
|
explicit |
Construct an EmailAddress object and initialize it with an email address.
address | Email address. |
Definition at line 61 of file EmailAddress.cpp.
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.
name | Name. |
address | Email address. |
Definition at line 65 of file EmailAddress.cpp.
EmailAddress & nawa::mail::EmailAddress::operator= | ( | const EmailAddress & | other | ) |
|
noexcept |
|
noexcept |
The name which is part of the email address.
|
noexcept |
|
noexcept |
|
noexcept |
The email address.
|
noexcept |
|
noexcept |
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.
includeName | Include the name in the representation (if set). |
applyPunycode | Convert the domain to punycode representation, if it is an IDN. |
Definition at line 70 of file EmailAddress.cpp.
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.
Definition at line 83 of file EmailAddress.cpp.