// // Created by dongl on 23-5-10. // #ifndef IM2_SEND_EMAIL_H #define IM2_SEND_EMAIL_H #include #include "smtp.h" #define DOMAIN "smtp.163.com" //smtp服务器域名 #define PORT 25 //smtp服务器域名 #define DEF_SEND_EMAIL "imbaseemail@163.com" //发件人的邮箱地址 #define DEF_SEND_EMAIL_PASS "XIALXUWEOCDPIYAC" //发件人密码 #define CODE_HTML_TEMPLATE(code) get_code_template(code) std::string get_code_template(const std::string& code); bool send_email_def(const std::string& target_email, const std::string& code) { Jxiepc::Smtp smtp( PORT, //服务器端口(默认25) DOMAIN, //smtp服务器域名 DEF_SEND_EMAIL, //发件人的邮箱地址 DEF_SEND_EMAIL_PASS, //发件人密码 target_email, //收件人 code + " 是你的IM验证码", //主题 CODE_HTML_TEMPLATE(code), //内容 "html" ); return smtp.getRet(); } bool send_email_def(const std::string& send_email, const std::string& password, const std::string& target_email, const std::string& code) { Jxiepc::Smtp smtp( PORT, //服务器端口(默认25) DOMAIN, //smtp服务器域名 send_email, //发件人的邮箱地址 password, //发件人密码 target_email, //收件人 code + " 是你的IM验证码", //主题 CODE_HTML_TEMPLATE(code), //内容 "html" ); return smtp.getRet(); } std::string get_code_template(const std::string& code) { std::string emaialcode[code.size()]; for (int i = 0; i < code.size(); ++i) { emaialcode[i] = code[i]; } return "\n" "\n" "\n" " \n" " 邮箱验证码\n" " \n" "\n" "\n" "\n" " \n" " \n" " \n" " \n" " \n" "
\n" "
\n" " \n" " \n" "
\n" "
\n" "
\n" "
\n" " 尊敬的用户:您好!\n" " \n" " 您正在进行注册账号操作,请在验证码中输入以下验证码完成操作:\n" " \n" "
\n" " \n" " \n" " \n" " \n" " \n" " \n" "
\n" "
\n" "
\n" " \n" " 注意:此操作可能会修改您的密码、登录邮箱或绑定手机。如非本人操作,请及时登录并修改密码以保证帐户安全\n" "
(工作人员不会向你索取此验证码,请勿泄漏!)\n" "
\n" "
\n" "
\n" "
\n" "
\n" "

此为系统邮件,请勿回复
\n" " 请保管好您的邮箱,避免账号被他人盗用\n" "

\n" "

——IM Base Email

\n" "
\n" "
\n" "
\n" "\n"; } #endif //IM2_SEND_EMAIL_H