if(SendMailSupported())
{
SendMail(fromName, fromMail, client.recoveryID, mail, subject, message);
} else
{
log(S + "no sendmail support. Saving message for " + client.recoveryID);
Str filename = FFirst("C:/inetpub/mailroot/Pickup/recover", "txt");
Str fileOnly = SkipStartPath(filename, "C:/inetpub/mailroot/Pickup/");
bool fileReady = false;
{
FileText f;
if(f.write(fileOnly, ANSI)) {
f.putLine(S + "From: " + fromName + " <" + fromMail + ">");
f.putLine(S + "To: " + client.recoveryID + " <" + mail + ">");
f.putLine(S + "Subject: " + subject);
f.putLine(S);
f.putText(message);
f.putLine(S);
f.putLine(".");
if(!f.flush())
{
log("Failed to send mail. Failed to flush file to disk.");
} else fileReady = true;
} else
{
log("Failed to send mail. Failed to open file for writing.");
}
}
if(fileReady && !FRename(fileOnly, filename))
{
log("Failed to send mail. Failed to move to pickup dir.");
FDelFile(fileOnly);
}
}