2015-09-08 17:21:04 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
#include "acl_cpp/acl_cpp_define.hpp"
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include "acl_cpp/stdlib/string.hpp"
|
|
|
|
|
#include "acl_cpp/http/http_ctype.hpp"
|
|
|
|
|
|
|
|
|
|
namespace acl {
|
|
|
|
|
|
|
|
|
|
class mime_code;
|
|
|
|
|
class mail_attach;
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
class ACL_CPP_API mail_body
|
|
|
|
|
{
|
|
|
|
|
public:
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD>
|
|
|
|
|
* @param charset {const char*} <EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param encoding {const char*} <EFBFBD><EFBFBD><EFBFBD>ĵı<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
mail_body(const char* charset = "utf-8",
|
|
|
|
|
const char* encoding = "base64");
|
|
|
|
|
~mail_body();
|
|
|
|
|
|
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>
|
|
|
|
|
* @return {const string&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
const string& get_content_type() const
|
|
|
|
|
{
|
|
|
|
|
return 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>
|
|
|
|
|
* @return {const http_ctype&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
const http_ctype& get_ctype() const
|
|
|
|
|
{
|
|
|
|
|
return ctype_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
2015-09-27 20:59:21 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ TEXT/HTML <EFBFBD><EFBFBD>ʽ
|
2015-09-16 21:03:02 +08:00
|
|
|
|
* @param html {const char*} HTML <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param len {size_t} html <EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>Ȼ html <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> strlen <EFBFBD><EFBFBD><EFBFBD>㳤<EFBFBD><EFBFBD>)
|
|
|
|
|
* @return {mail_body&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
mail_body& set_html(const char* html, size_t len);
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2015-09-27 20:59:21 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ TEXT/PLAIN <EFBFBD><EFBFBD>ʽ
|
|
|
|
|
* @param plain {const char*} TEXT <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param len {size_t} plain <EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>Ȼ plain <EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ṩ
|
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> strlen <EFBFBD><EFBFBD><EFBFBD>㳤<EFBFBD><EFBFBD>)
|
|
|
|
|
* @return {mail_body&}
|
|
|
|
|
*/
|
2015-09-27 20:59:21 +08:00
|
|
|
|
mail_body& set_plain(const char* plain, size_t len);
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ multipart/alternative <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 html {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD> HTML <EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD>ǿ<EFBFBD>)
|
|
|
|
|
* @param hlen {size_t} html <EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>(>0)
|
2015-09-27 20:59:21 +08:00
|
|
|
|
* @param plain {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD> TEXT <EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD>ǿ<EFBFBD>)
|
|
|
|
|
* @param plen {size_t} plain <EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>(>0)
|
2015-09-16 21:03:02 +08:00
|
|
|
|
* @return {mail_body&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
mail_body& set_alternative(const char* html, size_t hlen,
|
2015-09-27 20:59:21 +08:00
|
|
|
|
const char* plain, size_t plen);
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ multipart/relative <EFBFBD><EFBFBD>ʽʱ<EFBFBD><EFBFBD><EFBFBD>ô˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param html {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD> HTML <EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD>ǿ<EFBFBD>)
|
|
|
|
|
* @param hlen {size_t} html <EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>(>0)
|
2015-09-27 20:59:21 +08:00
|
|
|
|
* @param plain {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD> plain <EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD>ǿ<EFBFBD>)
|
|
|
|
|
* @param plen {size_t} plain <EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>(>0)
|
2015-09-16 21:03:02 +08:00
|
|
|
|
* @param attachments {const std::vector<mail_attach*>&} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD> html <EFBFBD>е<EFBFBD> cid <EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>ͼƬ<EFBFBD>ȸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {mail_body&}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
mail_body& set_relative(const char* html, size_t hlen,
|
2015-09-27 20:59:21 +08:00
|
|
|
|
const char* plain, size_t plen,
|
2015-09-08 17:21:04 +08:00
|
|
|
|
const std::vector<mail_attach*>& attachments);
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
2015-09-27 20:59:21 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> set_html <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> html/plain <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2015-09-16 21:03:02 +08:00
|
|
|
|
* @param len {size_t} <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_html(size_t& len) const
|
|
|
|
|
{
|
|
|
|
|
len = hlen_;
|
|
|
|
|
return html_;
|
|
|
|
|
}
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2015-09-27 20:59:21 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> set_plain <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> plain/plain <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2015-09-16 21:03:02 +08:00
|
|
|
|
* @param len {size_t} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD>Ƚ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const char*}
|
|
|
|
|
*/
|
2015-09-27 20:59:21 +08:00
|
|
|
|
const char* get_plain(size_t& len) const
|
2015-09-08 17:21:04 +08:00
|
|
|
|
{
|
2015-09-27 20:59:21 +08:00
|
|
|
|
len = plen_;
|
|
|
|
|
return plain_;
|
2015-09-08 17:21:04 +08:00
|
|
|
|
}
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> set_attachments <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õĸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const std::vector<mail_attach*>*}
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
const std::vector<mail_attach*>* get_attachments() const
|
|
|
|
|
{
|
|
|
|
|
return attachments_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-16 21:03:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<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 {ostream&} <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 save_to(ostream& out) const;
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<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>
|
|
|
|
|
* @return {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
bool save_to(string& out) const;
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* text/html <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 in {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> html <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param len {size_t} in <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param out {string&} <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 save_html(const char* in, size_t len, string& out) const;
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* text/plain <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 in {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> plain <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param len {size_t} in <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param out {string&} <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-27 20:59:21 +08:00
|
|
|
|
bool save_plain(const char* in, size_t len, string& out) const;
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* multipart/relative <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 html {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> html <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param hlen {size_t} html <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
2015-09-27 20:59:21 +08:00
|
|
|
|
* @param plain {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD> TEXT <EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD>ǿ<EFBFBD>)
|
|
|
|
|
* @param plen {size_t} plain <EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>(>0)
|
2015-09-16 21:03:02 +08:00
|
|
|
|
* @param attachments {const std::vector<mail_attach*>&} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD> html <EFBFBD>е<EFBFBD> cid <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>
|
|
|
|
|
* @return {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
|
|
|
|
|
*/
|
2015-09-08 17:21:04 +08:00
|
|
|
|
bool save_relative(const char* html, size_t hlen,
|
2015-09-27 20:59:21 +08:00
|
|
|
|
const char* plain, size_t plen,
|
2015-09-08 17:21:04 +08:00
|
|
|
|
const std::vector<mail_attach*>& attachments,
|
|
|
|
|
string& out) const;
|
2015-09-16 21:03:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* multipart/alternative <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 html {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> html <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param hlen {size_t} html <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
2015-09-27 20:59:21 +08:00
|
|
|
|
* @param plain {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD> TEXT <EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD>ǿ<EFBFBD>)
|
|
|
|
|
* @param plen {size_t} plain <EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>(>0)
|
2015-09-16 21:03:02 +08:00
|
|
|
|
* @param out {string&} <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 save_alternative(const char* html, size_t hlen,
|
2015-09-27 20:59:21 +08:00
|
|
|
|
const char* plain, size_t plen, string& out) const;
|
2015-09-08 17:21:04 +08:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
string charset_;
|
|
|
|
|
string content_type_;
|
|
|
|
|
string transfer_encoding_;
|
|
|
|
|
mime_code* coder_;
|
|
|
|
|
string boundary_;
|
|
|
|
|
http_ctype ctype_;
|
|
|
|
|
int mime_stype_;
|
|
|
|
|
|
|
|
|
|
const char* html_;
|
|
|
|
|
size_t hlen_;
|
2015-09-27 20:59:21 +08:00
|
|
|
|
const char* plain_;
|
|
|
|
|
size_t plen_;
|
2015-09-08 17:21:04 +08:00
|
|
|
|
const std::vector<mail_attach*>* attachments_;
|
|
|
|
|
|
2015-09-27 20:59:21 +08:00
|
|
|
|
bool build(const char* in, size_t len, const char* content_type,
|
|
|
|
|
const char* charset, mime_code& coder, string& out) const;
|
|
|
|
|
bool build_html(const char* in, size_t len,
|
|
|
|
|
const char* charset, string& out) const;
|
|
|
|
|
bool build_plain(const char* in, size_t len,
|
|
|
|
|
const char* charset, string& out) const;
|
|
|
|
|
|
2015-09-08 17:21:04 +08:00
|
|
|
|
void set_content_type(const char* content_type);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace acl
|