List of all members.
Public Member Functions |
| mail (std::ostream &a_out, bool a_verbose) |
virtual | ~mail () |
bool | send (const std::string &a_host, const std::string &a_from, const std::string &a_to, const std::string &a_subject, const std::string &a_msg, int a_port=mail_port()) |
Static Public Member Functions |
static int | mail_port () |
static int | secure_port () |
Protected Member Functions |
| mail (const mail &a_from) |
mail & | operator= (const mail &) |
bool | get_answer (std::string &a_answer) |
bool | send_command_no_answer (const std::string &a_cmd) |
bool | send_command (const std::string &a_cmd, std::string &a_answer) |
Static Protected Member Functions |
static char | LF () |
static char | CR () |
Detailed Description
Definition at line 15 of file mail.
Constructor & Destructor Documentation
inlib::net::mail::mail |
( |
std::ostream & |
a_out, |
|
|
bool |
a_verbose |
|
) |
| [inline] |
Definition at line 17 of file mail.
virtual inlib::net::mail::~mail |
( |
| ) |
[inline, virtual] |
Definition at line 20 of file mail.
inlib::net::mail::mail |
( |
const mail & |
a_from | ) |
[inline, protected] |
Definition at line 22 of file mail.
Member Function Documentation
static char inlib::net::mail::CR |
( |
| ) |
[inline, static, protected] |
Definition at line 91 of file mail.
bool inlib::net::mail::get_answer |
( |
std::string & |
a_answer | ) |
[inline, protected] |
Definition at line 93 of file mail.
{
char* buffer;
inlib::uint64 length;
if(!fetch_upto_char(CR(),buffer,length)) {
m_out << "inlib::net::mail::fetch_upto_char failed." << std::endl;
a_answer.clear();
return false;
}
*(buffer+length-1) = 0;
a_answer = buffer;
delete [] buffer;
if(m_verbose) {
m_out << "get_answer : " << sout(a_answer) << std::endl;
}
return true;
}
static char inlib::net::mail::LF |
( |
| ) |
[inline, static, protected] |
Definition at line 90 of file mail.
static int inlib::net::mail::mail_port |
( |
| ) |
[inline, static] |
Definition at line 25 of file mail.
mail& inlib::net::mail::operator= |
( |
const mail & |
| ) |
[inline, protected] |
Definition at line 23 of file mail.
static int inlib::net::mail::secure_port |
( |
| ) |
[inline, static] |
Definition at line 26 of file mail.
bool inlib::net::mail::send |
( |
const std::string & |
a_host, |
|
|
const std::string & |
a_from, |
|
|
const std::string & |
a_to, |
|
|
const std::string & |
a_subject, |
|
|
const std::string & |
a_msg, |
|
|
int |
a_port = mail_port() |
|
) |
| [inline] |
Definition at line 28 of file mail.
{
if(!connect(a_host,a_port,10,1)) return false;
{std::string answer;
if(!get_answer(answer)) return false;
if(answer.substr(0,3)!="220") {
m_out << "inlib::net::mail::send : not 220."
<< " Answer was " << sout(answer) << "."
<< std::endl;
return false;
}}
{std::string cmd = "HELO xxx";
std::string answer;
if(!send_command(cmd,answer)) return false;
if(answer.substr(0,3)!="250") {
m_out << "inlib::net::mail::send : not 250."
<< " Answer was " << sout(answer) << "."
<< std::endl;
return false;
}}
{std::string cmd = "MAIL FROM: "+a_from;
std::string answer;
if(!send_command(cmd,answer)) return false;}
{std::string cmd = "RCPT TO: "+a_to;
std::string answer;
if(!send_command(cmd,answer)) return false;}
{std::string cmd = "data";
std::string answer;
if(!send_command(cmd,answer)) return false;
if(answer.substr(0,3)!="354") {
m_out << "inlib::net::mail::send : not 354."
<< " Answer was " << sout(answer) << "."
<< std::endl;
return false;
}}
{std::string cmd = "Subject: "+a_subject;
if(!send_command_no_answer(cmd)) return false;}
{std::string cmd = a_msg;
if(!send_command_no_answer(cmd)) return false;}
{std::string cmd = ".";
if(!send_command_no_answer(cmd)) return false;}
{std::string cmd = "quit";
std::string answer;
if(!send_command(cmd,answer)) return false;}
return true;
}
bool inlib::net::mail::send_command |
( |
const std::string & |
a_cmd, |
|
|
std::string & |
a_answer |
|
) |
| [inline, protected] |
Definition at line 132 of file mail.
bool inlib::net::mail::send_command_no_answer |
( |
const std::string & |
a_cmd | ) |
[inline, protected] |
Definition at line 111 of file mail.
The documentation for this class was generated from the following file:
- /Users/barrand/private/dev/softinex/old/inexlib-1.2/inlib/inlib/net/mail