[Bps-public-commit] rt-extension-resetpassword branch, email-from-config-option, created. 1.07-4-g0695102
Jim Brandt
jbrandt at bestpractical.com
Fri Feb 19 09:16:40 EST 2021
The branch, email-from-config-option has been created
at 06951022146c240c7a8592b43462861711e1dca9 (commit)
- Log -----------------------------------------------------------------
commit 06951022146c240c7a8592b43462861711e1dca9
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Fri Feb 19 09:16:13 2021 -0500
Provide a config option to set email From address
diff --git a/README b/README
index ac6ec9d..a07d177 100644
--- a/README
+++ b/README
@@ -126,6 +126,11 @@ CONFIGURATION
password-change link expires. The default value is 4*60*60, meaning
that password-change links expire after four hours by default.
+ ResetPasswordFromAddress
+ By default, the From address in the password reset email is the
+ default $CorrespondAddress from RT. You can use this option to set a
+ different From address for the reset email.
+
AUTHOR
Best Practical Solutions, LLC <modules at bestpractical.com>
diff --git a/lib/RT/Extension/ResetPassword.pm b/lib/RT/Extension/ResetPassword.pm
index 18ea7da..d0b92de 100644
--- a/lib/RT/Extension/ResetPassword.pm
+++ b/lib/RT/Extension/ResetPassword.pm
@@ -38,7 +38,7 @@ sub CreateTokenAndResetPassword {
my $token = CreateToken($user);
return unless $token; # CreateToken will log error
- my ($status, $msg) = RT::Interface::Email::SendEmailUsingTemplate(
+ my %send_options = (
To => $user->EmailAddress,
Template => 'PasswordReset',
Arguments => {
@@ -46,6 +46,12 @@ sub CreateTokenAndResetPassword {
User => $user,
},
);
+
+ $send_options{'From'} = RT->Config->Get('ResetPasswordFromAddress')
+ if RT->Config->Get('ResetPasswordFromAddress');
+
+ my ($status, $msg) = RT::Interface::Email::SendEmailUsingTemplate(%send_options);
+
return ($status, $msg);
}
@@ -198,6 +204,12 @@ Set this config value to the time in seconds before a password-change
link expires. The default value is 4*60*60, meaning that password-change
links expire after four hours by default.
+=item C<ResetPasswordFromAddress>
+
+By default, the From address in the password reset email is the default
+C<$CorrespondAddress> from RT. You can use this option to set a
+different From address for the reset email.
+
=back
=cut
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list