2015-09-08 17:21:04 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
#include "acl_cpp/acl_cpp_define.hpp"
|
|
|
|
|
#include "acl_cpp/stdlib/string.hpp"
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
namespace acl {
|
|
|
|
|
|
|
|
|
|
class dbuf_pool;
|
|
|
|
|
struct rfc822_addr;
|
|
|
|
|
class mail_attach;
|
|
|
|
|
class mail_body;
|
|
|
|
|
class ofstream;
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>࣬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>ͬʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڹ<EFBFBD><EFBFBD><EFBFBD> SMTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>ŷ<EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
class ACL_CPP_API mail_message
|
|
|
|
|
{
|
|
|
|
|
public:
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD>
|
|
|
|
|
* @param charset {const char*} <EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
mail_message(const char* charset = "utf-8");
|
|
|
|
|
~mail_message();
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> SMTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
* @param user {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>
|
|
|
|
|
* @param pass {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {mail_message&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
mail_message& set_auth(const char* user, const char* pass);
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>ķ<EFBFBD><EFBFBD>Ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>䣬<EFBFBD><EFBFBD><EFBFBD>ֶο<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SMTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵<EFBFBD> MAIL FROM <EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* ͬʱ<EFBFBD>ֿ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ʼ<EFBFBD>ͷ<EFBFBD>е<EFBFBD> From <EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
* @param from {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>ַ
|
|
|
|
|
* @param name {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {mail_message&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
mail_message& set_from(const char* from, const char* name = NULL);
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
2015-09-08 17:21:04 +08:00
|
|
|
|
mail_message& set_sender(const char* sender, const char* name = NULL);
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>ͷ<EFBFBD>е<EFBFBD> Reply-To <EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
* @param reply_to {const char*} Reply-To <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
* @param name {const char*} Reply-To <EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {mail_message&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
mail_message& set_reply_to(const char* reply_to, const char* name = NULL);
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>ͷ<EFBFBD>е<EFBFBD> Return-Path <EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
* @param return_path {const char*} Return-Path <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
* @return {mail_message&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
mail_message& set_return_path(const char* return_path);
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>ͷ<EFBFBD>е<EFBFBD> Delivered-To <EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
* @param delivered_to {const char*} Delivered-To <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
* @return {mail_message&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
mail_message& set_delivered_to(const char* delivered_to);
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD>˵<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŷ<EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>ͷ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param recipients {const char*} <EFBFBD>ռ<EFBFBD><EFBFBD>˼<EFBFBD><EFBFBD>ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> RFC822 <EFBFBD><EFBFBD>ʽ
|
|
|
|
|
* @return {mail_message&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
mail_message& add_recipients(const char* recipients);
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>ͷ<EFBFBD>е<EFBFBD> To <EFBFBD>ֶ<EFBFBD>ֵ<EFBFBD><EFBFBD>ͬʱ<EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD>˵<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param to {const char*} <EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> RFC822 <EFBFBD><EFBFBD>ʽ
|
|
|
|
|
* @return {mail_message&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
mail_message& add_to(const char* to);
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>ͷ<EFBFBD>е<EFBFBD> Cc <EFBFBD>ֶ<EFBFBD>ֵ<EFBFBD><EFBFBD>ͬʱ<EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD>˵<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param cc {const char*} <EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> RFC822 <EFBFBD><EFBFBD>ʽ
|
|
|
|
|
* @return {mail_message&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
mail_message& add_cc(const char* cc);
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵İ<EFBFBD><EFBFBD>͵<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><EFBFBD>õ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>ͷ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param bcc {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> RFC822 <EFBFBD><EFBFBD>ʽ
|
|
|
|
|
* @return {mail_message&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
mail_message& add_bcc(const char* bcc);
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>ͷ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD>⣬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⽫<EFBFBD><EFBFBD><EFBFBD><EFBFBD> rfc2047 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param subject {const char*} <EFBFBD>ʼ<EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
* @return {mail_message&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
mail_message& set_subject(const char* subject);
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD><EFBFBD>ô˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>ͷ<EFBFBD>е<EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
* @param name {const char*} <EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param value {const char*} <EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
* @return {mail_message&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
mail_message& add_header(const char* name, const char* value);
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param body {const mail_body&} <EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {mail_message&}
|
|
|
|
|
*/
|
|
|
|
|
mail_message& set_body(const mail_body& body);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param filepath {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿգ<EFBFBD>
|
|
|
|
|
* @param content_type {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD>ǿգ<EFBFBD>
|
|
|
|
|
* @return {mail_message&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
mail_message& add_attachment(const char* filepath,
|
|
|
|
|
const char* content_type);
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ洢<EFBFBD>ڸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>գ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᴴ<EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
* @param filepath {const char*} Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
* @return {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
bool save_to(const char* filepath);
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param out {string&} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڸû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
bool build_header(string& out);
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>ȫ·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD> save_to <EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const char*}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
const char* get_email() const
|
|
|
|
|
{
|
|
|
|
|
return filepath_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SMTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>
|
|
|
|
|
* @return {const char*}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
const char* get_auth_user() const
|
|
|
|
|
{
|
|
|
|
|
return auth_user_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SMTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const char*}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
const char* get_auth_pass() const
|
|
|
|
|
{
|
|
|
|
|
return auth_pass_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> set_from <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const rfc822_addr*}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
const rfc822_addr* get_from() const
|
|
|
|
|
{
|
|
|
|
|
return from_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> set_sender <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const rfc822_addr*}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
const rfc822_addr* get_sender() const
|
|
|
|
|
{
|
|
|
|
|
return sender_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> set_reply_to <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const rfc822_addr*}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
const rfc822_addr* get_reply_to() const
|
|
|
|
|
{
|
|
|
|
|
return reply_to_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> set_return_path <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const rfc822_addr*}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
const rfc822_addr* get_return_path() const
|
|
|
|
|
{
|
|
|
|
|
return return_path_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> set_delivered_to <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const rfc822_addr*}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
const rfc822_addr* get_delivered_to() const
|
|
|
|
|
{
|
|
|
|
|
return delivered_to_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const std::vector<rfc822_addr*>& get_to() const
|
|
|
|
|
{
|
|
|
|
|
return to_list_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> set_cc <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const std::vector<rfc822_addr*>&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
const std::vector<rfc822_addr*>& get_cc() const
|
|
|
|
|
{
|
|
|
|
|
return cc_list_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> set_bcc <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const std::vector<rfc822_addr*>&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
const std::vector<rfc822_addr*>& get_bcc() const
|
|
|
|
|
{
|
|
|
|
|
return bcc_list_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵĵ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const std::vector<rfc822_addr*>&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
const std::vector<rfc822_addr*>& get_recipients() const
|
|
|
|
|
{
|
|
|
|
|
return recipients_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD>ʼ<EFBFBD>ͷ<EFBFBD><EFBFBD>չ<EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
* @param name {const char*} <EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const char*}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
const char* get_header_value(const char* name) const;
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* Ϊ MIME <EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><EFBFBD><EFBFBD>Ψһ<EFBFBD>ķָ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param id {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD> ID <EFBFBD><EFBFBD>ʶ
|
|
|
|
|
* @param out {string&} <EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
static void create_boundary(const char* id, string& out);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
dbuf_pool* dbuf_;
|
|
|
|
|
char* charset_;
|
|
|
|
|
char* transfer_encoding_;
|
|
|
|
|
|
|
|
|
|
char* auth_user_;
|
|
|
|
|
char* auth_pass_;
|
|
|
|
|
rfc822_addr* from_;
|
|
|
|
|
rfc822_addr* sender_;
|
|
|
|
|
rfc822_addr* reply_to_;
|
|
|
|
|
rfc822_addr* return_path_;
|
|
|
|
|
rfc822_addr* delivered_to_;
|
|
|
|
|
std::vector<rfc822_addr*> to_list_;
|
|
|
|
|
std::vector<rfc822_addr*> cc_list_;
|
|
|
|
|
std::vector<rfc822_addr*> bcc_list_;
|
|
|
|
|
std::vector<rfc822_addr*> recipients_;
|
|
|
|
|
char* subject_;
|
|
|
|
|
std::vector<std::pair<char*, char*> > headers_;
|
|
|
|
|
std::vector<mail_attach*> attachments_;
|
|
|
|
|
const mail_body* body_;
|
|
|
|
|
size_t body_len_;
|
|
|
|
|
char* filepath_;
|
|
|
|
|
|
|
|
|
|
void add_addrs(const char* in, std::vector<rfc822_addr*>& out);
|
|
|
|
|
bool append_addr(const rfc822_addr& addr, string& out);
|
|
|
|
|
bool append_addr(const char* name, const rfc822_addr& addr,
|
|
|
|
|
string& out);
|
|
|
|
|
bool append_addrs(const char* name,
|
|
|
|
|
const std::vector<rfc822_addr*>& addrs, string& out);
|
|
|
|
|
bool append_message_id(string& out);
|
|
|
|
|
bool append_subject(const char* subject, string& out);
|
|
|
|
|
bool append_date(string& out);
|
|
|
|
|
bool append_header(ofstream& fp);
|
|
|
|
|
bool append_multipart(ofstream& fp);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace acl
|