//------------------------------------------------------------------------------------- bool SendEMailTask::process() { jwsmtp::mailer m(emailaddr_.c_str(), g_kbeSrvConfig.emailServerInfo_.username.c_str(), subject(), g_kbeSrvConfig.emailAtivationInfo_.subject.c_str(), g_kbeSrvConfig.emailServerInfo_.smtp_server.c_str(), g_kbeSrvConfig.emailServerInfo_.smtp_port, false); m.authtype(g_kbeSrvConfig.emailServerInfo_.smtp_auth == 1 ? jwsmtp::mailer::LOGIN : jwsmtp::mailer::PLAIN); std::string mailmessage = message(); KBEngine::strutil::kbe_replace(mailmessage, "${backlink}", (boost::format("http://%1%:%2%/%3%_%4%") % cbaddr_ % cbport_ % getopkey() % code_).str()); KBEngine::strutil::kbe_replace(mailmessage, "${username}", emailaddr_); KBEngine::strutil::kbe_replace(mailmessage, "${code}", code_); m.setmessageHTML(mailmessage); m.username(g_kbeSrvConfig.emailServerInfo_.username.c_str()); m.password(g_kbeSrvConfig.emailServerInfo_.password.c_str()); m.send(); // send the mail INFO_MSG(boost::format("SendEMailTask::process: sendmail[%1%]: %2%\n") % getopkey() % m.response()); return false; }
//------------------------------------------------------------------------------------- bool SendEMailTask::process() { jwsmtp::mailer m(emailaddr_.c_str(), g_kbeSrvConfig.emailServerInfo_.username.c_str(), subject(), g_kbeSrvConfig.emailAtivationInfo_.subject.c_str(), g_kbeSrvConfig.emailServerInfo_.smtp_server.c_str(), g_kbeSrvConfig.emailServerInfo_.smtp_port, false); m.authtype(g_kbeSrvConfig.emailServerInfo_.smtp_auth == 1 ? jwsmtp::mailer::LOGIN : jwsmtp::mailer::PLAIN); std::string mailmessage = message(); KBEngine::strutil::kbe_replace(mailmessage, "${backlink}", fmt::format("http://{}:{}/{}_{}", cbaddr_, cbport_, getopkey(), code_)); KBEngine::strutil::kbe_replace(mailmessage, "${username}", emailaddr_); KBEngine::strutil::kbe_replace(mailmessage, "${code}", code_); mailmessage = KBEngine::strutil::kbe_trim(mailmessage); m.setmessageHTML(mailmessage); m.username(g_kbeSrvConfig.emailServerInfo_.username.c_str()); m.password(g_kbeSrvConfig.emailServerInfo_.password.c_str()); m.send(); // send the mail INFO_MSG(fmt::format("SendEMailTask::process: sendmail[{}]: {}\n", getopkey(), m.response())); return false; }