#include <mail.h>
Public Types | |
typedef std::vector< std::string > | text_type |
enum | { mfAuthenticated = 0x00000001, mfNoQuota = 0x00000002 } |
Send flags. More... | |
enum | { meSuccess = 0x00000000, meIncomplete = 0x00000001, meQuota = 0x00000002, meDelivery = 0x0000004, meConfig = 0x00000008, meTemporary = 0x80000000 } |
Error constants. More... | |
Public Member Functions | |
Mail () | |
Constructor. | |
Mail (Mail const &m) | |
Copy constructor. | |
Mail & | operator= (Mail const &right) |
Assignment operator. | |
bool | send (uint32_t flags, uint32_t *err=0, std::string *errdesc=0) |
Sends the mail. | |
std::string const & | from_name () const |
Returns the name part of the From: field. | |
std::string const & | from_name (std::string const &from_name) |
Sets the name part of the From: field. | |
std::string const & | from_address () const |
Returns the address part of the From: field. | |
std::string const & | from_address (std::string const &from_address) |
Sets the address part of the From: field. | |
std::string const & | subject () const |
Returns the Subject: field. | |
std::string const & | subject (std::string const &subject) |
Sets the Subject: field. | |
std::string const & | sender () const |
Returns the Sender: field. | |
std::string const & | sender (std::string const &sender) |
Sets the Sender: field. | |
std::string const & | to_name () const |
Returns the name part of the To: field. | |
std::string const & | to_name (std::string const &to_name) |
Sets the name part of the To: field. | |
std::string const & | to_address () const |
Returns the address part of the To: field. | |
std::string const & | to_address (std::string const &to_address) |
Sets the address part of the To: field. | |
std::string const & | origin () const |
Returns the X-Origin: field. | |
std::string const & | origin (std::string const &origin) |
Sets the X-Origin: field. | |
text_type const & | text () const |
Returns the vector containing the current text lines. | |
text_type const & | text_add (std::string const &line) |
Adds a line to the e-mail text. | |
text_type const & | text_addf (char const *format,...) FORMAT(printf |
printf-like version of text_add(). | |
text_type const std::string const & | data () const |
Returns the mail data. | |
Static Public Member Functions | |
static bool | configured () |
Determines whether the mail subsystem has been configured. | |
static bool | valid_address (char const *address, bool noplus) |
Checks for address validity. |
|
|
|
|
|
Returns the mail data. The data is generated in the send() function and consists of the mail headers and text formatted in a suitable way.
|
|
Sets the X-Origin field. This field is also used by the send() function to determine whether the sender limit has been exceeded.
|
|
Sends the mail. Please note that the e-mail is not guaranteed to have been effectively sent when the function returns; mail transport modules are not required to process the mails synchronously. However, the mail object may be deleted once this call has been done, as it is copied as necessary if needed. The only required field that needs to have been filled before calling this function is to_address(). All other fields are either optional or they have default values.
|
|
Adds a line to the e-mail text. It must NOT end with a newline character.
|
|
Checks whether an e-mail address is syntaxically valid. The check does not entirely follow RFC 822; we're allowing only a subset of what is (theorically) allowed. However, this should be enough to cover 99,99% of the e-mail addresses commonly in use today while ensuring people don't type in subtly invalid addresses that somehow would still get accepted.
|