#include "mailer.ih"

    // appending is for logging the information on a separate file that
    // can be inspected via, e.g., a webbrowser

void Mailer::inspectAppend(string const &txt)
{
    string path;
    if (not ArgConfig::instance().option(&path, "append"))
        return;
    
    ofstream append(path, ios::app);

    size_t pos = 0;
    string text{txt};

    while (true)
    {
        pos = text.find('\n', pos);
        if (pos == string::npos)
            break;
        text[pos] = ' ';
    }

    append << time(0) << ' ' << setw(25) << d_to << "    " << text << '\n';
    log() << "Appended info to `" << path << "'\n";
}
