MCPcopy Create free account
hub / github.com/acl-dev/acl / build_mixed_html

Function build_mixed_html

lib_acl_cpp/samples/mime/mail_build/main.cpp:401–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399}
400
401static 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
436static void build_mixed_plain(void)
437{

Callers 1

mainFunction · 0.85

Calls 5

set_bodyMethod · 0.80
last_serrorFunction · 0.50
c_strMethod · 0.45
sizeMethod · 0.45
save_toMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…