40 inline bool send_mail(
const std::string& server,
int port,
const std::string& login,
const std::string& pass,
const std::string& from_addres,
const std::string& from_name,
const std::string& maillist,
const std::string& subject,
const std::string& mail_body)
42 net_utils::smtp::CSMTPClient
smtp;
44 if ( !
smtp.ServerConnect( server.c_str(), port ) )
46 LOG_PRINT(
"Reporting: Failed to connect to server " << server <<
":"<< port, LOG_LEVEL_0);
50 if(login.size() && pass.size())
52 if ( !
smtp.ServerLogin( login.c_str(), pass.c_str()) )
54 LOG_PRINT(
"Reporting: Failed to auth on server " << server <<
":"<< port, LOG_LEVEL_0);
60 if ( !
smtp.SendMessage( from_addres.c_str(),
65 (LPBYTE)mail_body.data(),
68 char *szErrorText =
smtp.GetLastErrorText();
71 LOG_PRINT(
"Failed to send message, error text: " << szErrorText, LOG_LEVEL_0);
75 LOG_PRINT(
"Failed to send message, error text: null", LOG_LEVEL_0);
80 smtp.ServerDisconnect();
bool send_mail(const std::string &server, int port, const std::string &login, const std::string &pass, const std::string &from_email, const std::string &maillist, const std::string &subject, const std::string &body)