diff options
Diffstat (limited to 'perllib/FixMyStreet/Email.pm')
-rw-r--r-- | perllib/FixMyStreet/Email.pm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/Email.pm b/perllib/FixMyStreet/Email.pm index 2b72b5c63..3d7b48539 100644 --- a/perllib/FixMyStreet/Email.pm +++ b/perllib/FixMyStreet/Email.pm @@ -152,7 +152,7 @@ sub find_template_dir { sub send_cron { my ( $schema, $template, $vars, $hdrs, $env_from, $nomail, $cobrand, $lang_code ) = @_; - my $sender = FixMyStreet->config('DO_NOT_REPLY_EMAIL'); + my $sender = $cobrand->do_not_reply_email; $env_from ||= $sender; if (!$hdrs->{From}) { my $sender_name = $cobrand->contact_name; @@ -169,15 +169,20 @@ sub send_cron { push @include_path, FixMyStreet->path_to( 'templates', 'email', 'default' ); my $tt = FixMyStreet::Template->new({ INCLUDE_PATH => \@include_path, + disable_autoescape => 1, }); $vars->{signature} = _render_template($tt, 'signature.txt', $vars); $vars->{site_name} = Utils::trim_text(_render_template($tt, 'site-name.txt', $vars)); + $vars->{staging} = FixMyStreet->config('STAGING_SITE'); $hdrs->{_body_} = _render_template($tt, $template, $vars); if ($html_template) { my @inline_images; $vars->{inline_image} = sub { add_inline_image(\@inline_images, @_) }; $vars->{file_exists} = sub { -e FixMyStreet->path_to(@_) }; + my $tt = FixMyStreet::Template->new({ + INCLUDE_PATH => \@include_path, + }); $hdrs->{_html_} = _render_template($tt, $html_template, $vars); $hdrs->{_html_images_} = \@inline_images; } @@ -357,8 +362,9 @@ sub construct_email ($) { } } - if ($p->{_attachments_}) { + if (@{$p->{_attachments_}}) { push @$parts, map { _mime_create(%$_) } @{$p->{_attachments_}}; + $overall_type = 'multipart/mixed'; } my $email = Email::MIME->create( |