Determine eMail's Content-Type "text/html" if message has "<" and ">" at the beginning and the end.
This commit is contained in:
parent
217c350f12
commit
70f1fb159b
|
@ -1074,13 +1074,25 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
|||
};
|
||||
|
||||
# Default content type
|
||||
my $content_type = 'text/html; charset="iso-8859-1"';
|
||||
my $content_type;
|
||||
|
||||
# Check if message looks like html.
|
||||
# Assume that html message starts with "<" and ends with ">".
|
||||
if ($field3 =~ /^\s*<.*>\s*$/s ) {
|
||||
$content_type = 'text/html;';
|
||||
}
|
||||
else {
|
||||
$content_type = 'text/plain;';
|
||||
}
|
||||
|
||||
# Check if message has non-ascii chars.
|
||||
# non-ascii chars should be encoded in UTF-8.
|
||||
if ($field3 =~ /[^[:ascii:]]/o) {
|
||||
$field3 = encode("UTF-8", $field3);
|
||||
$content_type = 'text/plain; charset="UTF-8"';
|
||||
$content_type .= ' charset="UTF-8"';
|
||||
}
|
||||
else {
|
||||
$content_type .= ' charset="iso-8859-1"';
|
||||
}
|
||||
|
||||
# Build the mail with attached content
|
||||
|
|
Loading…
Reference in New Issue