diff options
Diffstat (limited to 'perllib/FixMyStreet/SendReport/Email.pm')
-rw-r--r-- | perllib/FixMyStreet/SendReport/Email.pm | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/SendReport/Email.pm b/perllib/FixMyStreet/SendReport/Email.pm index 9006e2f11..e8151f175 100644 --- a/perllib/FixMyStreet/SendReport/Email.pm +++ b/perllib/FixMyStreet/SendReport/Email.pm @@ -33,14 +33,24 @@ sub build_recipient_list { $self->unconfirmed_notes->{$body_email}{$row->category} = $note; } + my $body_name = $body->name; # see something uses council areas but doesn't send to councils so just use a # generic name here to minimise confusion if ( $row->cobrand eq 'seesomething' ) { - push @{ $self->to }, [ $body_email, 'See Something, Say Something' ]; + $body_name = 'See Something, Say Something'; + } + + my @emails; + # allow multiple emails per contact + if ( $body_email =~ /,/ ) { + @emails = split(/,/, $body_email); } else { - push @{ $self->to }, [ $body_email, $body->name ]; + @emails = ( $body_email ); + } + for my $email ( @emails ) { + push @{ $self->to }, [ $email, $body_name ]; + $recips{$email} = 1; } - $recips{$body_email} = 1; } return () unless $all_confirmed; @@ -74,7 +84,7 @@ sub send { # on a staging server send emails to ourselves rather than the bodies if (mySociety::Config::get('STAGING_SITE') && !mySociety::Config::get('SEND_REPORTS_ON_STAGING') && !FixMyStreet->test_mode) { - @recips = ( mySociety::Config::get('CONTACT_EMAIL') ); + @recips = ( $row->user->email ); } unless ( @recips ) { |