diff options
author | M Somerville <matthew-github@dracos.co.uk> | 2020-09-30 20:04:10 +0100 |
---|---|---|
committer | M Somerville <matthew-github@dracos.co.uk> | 2020-09-30 20:04:10 +0100 |
commit | 57f4048942a8caaf702f47373fabdfa31932659e (patch) | |
tree | f9b2272947b0c59c7c1e843186d850d52f21bee4 /perllib/FixMyStreet/TestMech.pm | |
parent | 3a511f5facc4bd066f0e7e4d00060979686bb766 (diff) | |
parent | dffc4acfe67fb05f928806601bab8ce1057e7b67 (diff) |
Merge branch 'issues/commercial/1928-html-in-response-templates'
Diffstat (limited to 'perllib/FixMyStreet/TestMech.pm')
-rw-r--r-- | perllib/FixMyStreet/TestMech.pm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm index 277eca2b1..f6854fc98 100644 --- a/perllib/FixMyStreet/TestMech.pm +++ b/perllib/FixMyStreet/TestMech.pm @@ -276,6 +276,24 @@ sub get_text_body_from_email { return $body; } +sub get_html_body_from_email { + my ($mech, $email, $obj) = @_; + unless ($email) { + $email = $mech->get_email; + $mech->clear_emails_ok; + } + + my $body; + $email->walk_parts(sub { + my $part = shift; + return if $part->subparts; + return if $part->content_type !~ m{text/html}; + $body = $obj ? $part : $part->body_str; + ok $body, "Found HTML body"; + }); + return $body; +} + sub get_link_from_email { my ($mech, $email, $multiple, $mismatch) = @_; unless ($email) { |