| 399 | } |
| 400 | |
| 401 | static void build_mixed_html(void) |
| 402 | { |
| 403 | acl::mail_message message("gbk"); |
| 404 | |
| 405 | message.set_from("zsxxsz@263.net", "֣����") |
| 406 | .set_sender("zsx1@263.net") |
| 407 | .set_reply_to("zsx2@263.net") |
| 408 | .add_to("\"֣����1\" <zsx1@sina.com>; \"֣����2\" <zsx2@sina.com>") |
| 409 | .add_cc("\"֣����3\" <zsx1@163.com>; \"֣����4\" <zsx2@163.com>") |
| 410 | .set_subject("���⣺�й��������У�"); |
| 411 | |
| 412 | message.add_attachment("main.cpp", "text/plain") |
| 413 | .add_attachment("var/email2/architecture.pptx", "application/ms-pptx"); |
| 414 | |
| 415 | const char* html_file = "./var/html.txt"; |
| 416 | acl::string html; |
| 417 | if (acl::ifstream::load(html_file, &html) == false) |
| 418 | { |
| 419 | printf("load %s error %s\r\n", html_file, acl::last_serror()); |
| 420 | return; |
| 421 | } |
| 422 | |
| 423 | ///////////////////////////////////////////////////////////////////// |
| 424 | |
| 425 | acl::mail_body body("gbk"); |
| 426 | body.set_html(html.c_str(), html.size()); |
| 427 | message.set_body(body); |
| 428 | |
| 429 | const char* filepath = "./mixed_html.eml"; |
| 430 | if (message.save_to(filepath) == false) |
| 431 | printf("compose %s error: %s\r\n", filepath, acl::last_serror()); |
| 432 | else |
| 433 | printf("compose %s ok\r\n", filepath); |
| 434 | } |
| 435 | |
| 436 | static void build_mixed_plain(void) |
| 437 | { |