!7

p {
  createPWFile(passwordFile());
}

static File passwordFile() {
  ret javaxSecretDir("mail-sender-bot-pw");
}

html {
  S realPW = assertNempty(loadTextFileTrim(passwordFile()));
  S pw = params.get("pw");
  if (!eq(pw, realPW)) ret "Bad PW";
  
  S from = params.get("from");
  S to = params.get("to");
  S subject = params.get("subject");
  S text = params.get("text");
  
  javaMail_sendThroughLocalhost(from, to, subject, text);

  ret "OK, mail sent";
}