Email::add_attachment(boost::filesystem::path file, string name, string mime_type)
{
Attachment a;
- a.file = file;
+ a.file = dcp::ArrayData(file);
a.name = name;
a.mime_type = mime_type;
_attachments.push_back (a);
}
bio = BIO_push (b64, bio);
- ArrayData data (i.file);
- BIO_write (bio, data.data(), data.size());
+ BIO_write(bio, i.file.data(), i.file.size());
(void) BIO_flush (bio);
char* out;
void add_cc (std::string cc);
void add_bcc (std::string bcc);
+ /** Add attachment, copying the contents of the file into memory */
void add_attachment (boost::filesystem::path file, std::string name, std::string mime_type);
void send (std::string server, int port, EmailProtocol protocol, std::string user = "", std::string password = "");
std::vector<std::string> _bcc;
struct Attachment {
- boost::filesystem::path file;
+ dcp::ArrayData file;
std::string name;
std::string mime_type;
};
}
email.add_attachment (zip_file, container_name_format.get(first->name_values(), ".zip"), "application/zip");
+ dcp::filesystem::remove(zip_file);
auto log_details = [](Email& email) {
dcpomatic_log->log("Email content follows", LogEntry::TYPE_DEBUG_EMAIL);
try {
email.send (config->mail_server(), config->mail_port(), config->mail_protocol(), config->mail_user(), config->mail_password());
} catch (...) {
- dcp::filesystem::remove(zip_file);
log_details (email);
throw;
}
log_details (email);
-
- dcp::filesystem::remove(zip_file);
}
}