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

Method save_to

lib_acl_cpp/src/smtp/mail_message.cpp:478–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476}
477
478bool mail_message::save_to(const char* filepath)
479{
480 ofstream fp;
481 if (!fp.open_write(filepath)) {
482 logger_error("open %s error: %s", filepath, last_serror());
483 return false;
484 }
485
486 filepath_ = dbuf_->dbuf_strdup(filepath);
487
488 // �������ʼ�ͷ�����������ļ�����
489
490 if (!append_header(fp)) {
491 return false;
492 }
493
494 // ����� multipart ��ʽ���� multipart ����������ļ�����
495
496 if (!attachments_.empty()) {
497 return append_multipart(fp);
498 }
499
500 if (body_ == NULL) {
501 logger_error("body null!");
502 return false;
503 }
504
505 // �Է� multipart ��ʽ��ֱ�ӽ���������������ļ�����
506
507 string buf(8192);
508 if (!body_->save_to(buf)) {
509 return false;
510 }
511
512 if (fp.write(buf) == -1) {
513 logger_error("write to %s error %s",
514 fp.file_path(), last_serror());
515 return false;
516 }
517
518 return true;
519}
520
521} // namespace acl
522

Callers 1

append_multipartMethod · 0.45

Calls 6

dbuf_strdupMethod · 0.80
file_pathMethod · 0.80
last_serrorFunction · 0.50
open_writeMethod · 0.45
emptyMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected