diff --git a/system/bin/send_email.php b/system/bin/send_email.php new file mode 100644 index 00000000..be9ebf62 --- /dev/null +++ b/system/bin/send_email.php @@ -0,0 +1,55 @@ +find($email_account_name); + } + else { + $account->load($email_account_name); + } + + if($account->isLoaded()) { + $email_account_name = $account->getEMail(); + } + else { + $player = new OTS_Player(); + $player->find($email_account_name); + if($player->isLoaded()) { + $email_account_name = $player->getAccount()->getEMail(); + } + else { + exit('Cannot find player or account with name: ' . $email_account_name . '.' . PHP_EOL); + } + } +} + +if(!Validator::email($email_account_name)) { + exit('Invalid E-Mail format.' . PHP_EOL); +} + +if(strlen($subject) > 255) { + exit('Subject max length is 255 characters.' . PHP_EOL); +} + +if(!_mail($email_account_name, $subject, $message)) { + exit('Error while sending mail: ' . $mailer->ErrorInfo . PHP_EOL); +} + +echo 'Mail sent to ' . $email_account_name . '.' . PHP_EOL; \ No newline at end of file