C++发送邮件-jwsmpt
jwSMTP是用于发送邮件的C++库,支持附件、多接收者,抄送等功能。下载地址jwSMTP.
1.安装
tar, ./configure配置安装路径,make, make install。
2.使用
#include <jwsmpt/jwsmpt.h> jwsmtp::mailer mail_; mail_.setsender(from_); mail_.username(from_); mail_.password(pwd_); mail_.setserver(smpt_server_);//服务器,如smpt.126.com mail_.addrecipient(receiver); mail_.setsubject(subject_); mail_.setmessageHTML(os.str());//支持HTML内容 mail_.send();
if(mail_.response( ).substr(0,3) != "250") { cout << "Send Error."; }
具体可以参考其doc