summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Helper/Sendmail.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-04-13 12:17:19 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-04-13 12:18:26 +0200
commit80a6317ac55de020f606a5ca114466d3f0100511 (patch)
tree9bd5104c3f07cda2f07f3a783e71e1e5b948f943 /lib/Travelynx/Helper/Sendmail.pm
parent61b1ef398e275a110173ed77556ff211adc1ba82 (diff)
Use travelynx.conf for configuration and secrets
This avoids having to specify secrets in the environment, where they can leak easily.
Diffstat (limited to 'lib/Travelynx/Helper/Sendmail.pm')
-rw-r--r--lib/Travelynx/Helper/Sendmail.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Travelynx/Helper/Sendmail.pm b/lib/Travelynx/Helper/Sendmail.pm
index 6193884..09c8a0d 100644
--- a/lib/Travelynx/Helper/Sendmail.pm
+++ b/lib/Travelynx/Helper/Sendmail.pm
@@ -12,11 +12,11 @@ use Email::Simple;
sub new {
my ($class) = @_;
- return bless({}, $class);
+ return bless( {}, $class );
}
sub custom {
- my ($self, $to, $subject, $body) = @_;
+ my ( $self, $to, $subject, $body ) = @_;
my $reg_mail = Email::Simple->create(
header => [
@@ -28,7 +28,8 @@ sub custom {
body => encode( 'utf-8', $body ),
);
- if ($ENV{TRAVELYNX_DB_NAME} =~ m{travelynx_dev}) {
+ if ( $self->app->config->{db}->{database} =~ m{travelynx_dev} ) {
+
# Do not send mail in dev mode
say "sendmail to ${to}: ${subject}\n\n${body}";
return 1;