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 { echo 'Cannot find player or account with name: ' . $email_account_name . '.' . PHP_EOL; exit(3); } } } if(!Validator::email($email_account_name)) { echo 'Invalid E-Mail format.' . PHP_EOL; exit(4); } if(strlen($subject) > 255) { echo 'Subject max length is 255 characters.' . PHP_EOL; exit(5); } if(!_mail($email_account_name, $subject, $message)) { echo 'An error occurred while sending email. More info can be found in system/logs/mailer-error.log'; exit(6); } echo 'Mail sent to ' . $email_account_name . '.' . PHP_EOL;