41 {
42 net_utils::smtp::CSMTPClient
smtp;
43
44 if ( !
smtp.ServerConnect( server.c_str(), port ) )
45 {
46 LOG_PRINT("Reporting: Failed to connect to server " << server <<":"<< port, LOG_LEVEL_0);
47 return false;
48 }
49
50 if(login.size() && pass.size())
51 {
52 if ( !
smtp.ServerLogin( login.c_str(), pass.c_str()) )
53 {
54 LOG_PRINT("Reporting: Failed to auth on server " << server <<":"<< port, LOG_LEVEL_0);
55 return false;
56
57 }
58 }
59
60 if ( !smtp.SendMessage( from_addres.c_str(),
61 from_name.c_str(),
62 maillist.c_str(),
63 subject.c_str(),
64 "bicycle-client",
65 (LPBYTE)mail_body.data(),
66 mail_body.size()))
67 {
68 char *szErrorText = smtp.GetLastErrorText();
69 if ( szErrorText )
70 {
71 LOG_PRINT("Failed to send message, error text: " << szErrorText, LOG_LEVEL_0);
72 }
73 else
74 {
75 LOG_PRINT("Failed to send message, error text: null", LOG_LEVEL_0);
76 }
77 return false;
78 }
79
80 smtp.ServerDisconnect();
81
82 return true;
83
84
85 }