diff options
author | derekmurawsky <[email protected]> | 2013-03-22 16:25:12 -0400 |
---|---|---|
committer | derekmurawsky <[email protected]> | 2013-03-22 16:25:12 -0400 |
commit | 1b2afd2bd3dc19cdd36da47cc52040a83cdb3b68 (patch) | |
tree | 286d5b99c3a895d2f756fae5c17a55122ee7a7f0 /register.php | |
parent | 9d9432dab87e3887e4f482ac5afff1586530c692 (diff) |
Additions:
classes/trssmailer.php - Created class TTRSS mailer which extends phpmailer and sets the default mail settings upon instantiation. Class includes quickmail function that allows for a quick email send with no extra configurion necessary.
Changes:
config.php-dist - Added the smtp port option
include/digest.php - Converted it to use the new ttrrssmailer class
include/sanity_config.php - Added the smtp port option to the sanity check
plugins/mail/init.php - Modified to use ttrssmailer class. This particular configuration shows a hybrid use case.
register.php = Modified to use ttrssmailer class.
All code was tested and functioned on my local machine.
Diffstat (limited to 'register.php')
-rw-r--r-- | register.php | 67 |
1 files changed, 15 insertions, 52 deletions
diff --git a/register.php b/register.php index 678b3c317..8c9869a52 100644 --- a/register.php +++ b/register.php @@ -7,7 +7,7 @@ set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . get_include_path()); - require_once 'lib/phpmailer/class.phpmailer.php'; + require_once 'classes/ttrssmailer.php'; require_once "functions.php"; require_once "sessions.php"; @@ -306,65 +306,28 @@ "\n". "If that wasn't you, just ignore this message. Thanks."; - $mail = new PHPMailer(); - - $mail->PluginDir = "lib/phpmailer/"; - $mail->SetLanguage("en", "lib/phpmailer/language/"); - - $mail->CharSet = "UTF-8"; - - $mail->From = SMTP_FROM_ADDRESS; - $mail->FromName = SMTP_FROM_NAME; - $mail->AddAddress($email); - - if (SMTP_HOST) { - $mail->Host = SMTP_HOST; - $mail->Mailer = "smtp"; - $mail->Username = SMTP_LOGIN; - $mail->Password = SMTP_PASSWORD; - } - - // $mail->IsHTML(true); - $mail->Subject = "Registration information for Tiny Tiny RSS"; - $mail->Body = $reg_text; - // $mail->AltBody = $digest_text; - - $rc = $mail->Send(); + $mail = new ttrssMailer(); + $mail->IsHTML(false); + $rc = $mail->quickMail($email, "", "Registration information for Tiny Tiny RSS", $reg_text, false); if (!$rc) print_error($mail->ErrorInfo); - + + unset($reg_text); + unset($mail); + unset($rc); $reg_text = "Hi!\n". "\n". "New user had registered at your Tiny Tiny RSS installation.\n". "\n". "Login: $login\n". "Email: $email\n"; - - $mail = new PHPMailer(); - - $mail->PluginDir = "lib/phpmailer/"; - $mail->SetLanguage("en", "lib/phpmailer/language/"); - - $mail->CharSet = "UTF-8"; - - $mail->From = SMTP_FROM_ADDRESS; - $mail->FromName = SMTP_FROM_NAME; - $mail->AddAddress(REG_NOTIFY_ADDRESS); - - if (SMTP_HOST) { - $mail->Host = SMTP_HOST; - $mail->Mailer = "smtp"; - $mail->Username = SMTP_LOGIN; - $mail->Password = SMTP_PASSWORD; - } - - // $mail->IsHTML(true); - $mail->Subject = "Registration notice for Tiny Tiny RSS"; - $mail->Body = $reg_text; - // $mail->AltBody = $digest_text; - - $rc = $mail->Send(); - + + + $mail = new ttrssMailer(); + $mail->IsHTML(false); + $rc = $mail->quickMail(REG_NOTIFY_ADDRESS, "", "Registration notice for Tiny Tiny RSS", $reg_text, false); + if (!$rc) print_error($mail->ErrorInfo); + print_notice(__("Account created successfully.")); print "<p><form method=\"GET\" action=\"index.php\"> |