From 0635a2a17ee2d354f5058dfebd48a6f1afd4f8ca Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Thu, 19 Jul 2007 16:51:46 +0000 Subject: [PATCH] fix relative links in emails --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Mail/Send.pm | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index e2015e13f..637b63550 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -72,6 +72,7 @@ - add: Password recovery can now be based on profile fields or simply by the user's e-mail address. - add: Button in Collaboration Systems for managing CS subscription group. + - fix: relative links sent out in emails don't work properly 7.3.21 - fix: Self-deactivation doesn't show login screen after success diff --git a/lib/WebGUI/Mail/Send.pm b/lib/WebGUI/Mail/Send.pm index 634db8403..67ec92a75 100644 --- a/lib/WebGUI/Mail/Send.pm +++ b/lib/WebGUI/Mail/Send.pm @@ -131,6 +131,38 @@ A string of HTML. =cut sub addHtml { + my $self = shift; + my $text = shift; + if ($text !~ /<(?:html|body)/) { + my $site = $self->session->url->getSiteURL; + $text = < + + + + +$text + + +END_HTML + } + $self->addHtmlRaw($text); +} + + +#------------------------------------------------------------------- + +=head2 addHtmlRaw ( html ) + +Appends an HTML block to the message without wrapping in a document. + +=head3 html + +A string of HTML. + +=cut + +sub addHtmlRaw { my $self = shift; my $text = shift; $self->{_message}->attach(