nms FormMail and Japanese characters
Recently Reev sent me a query about using nms FormMail to collect message containing Japanese characters.
The documentation for nms FormMail seems to suggest that you only need to change the $charset variable in the USER CONFIGURATION SECTION from 'iso-8859-1' to 'utf-8'.
Unfortunately this does not appear to be enough to allow email clients to correctly display emails generated by nms FormMail.
To get the Japanese characters to correctly display in the email client it is necessary to provide some hints on the encoding used. To achieve this the following headers need to be added to the email:
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=utf-8
These can be added to the email by updating the sub routine** send_main_email_header**, changing the code from
...
$self->mailer->print(<<END);
X-Mailer: ${\( $self->name_and_version )}
To: $to
From: $from
Subject: $subject
END
...
to
...
$self->mailer->print(<<END);
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=utf-8
X-Mailer: ${\( $self->name_and_version )}
To: $to
From: $from
Subject: $subject
END
...
It is also necessary to ensure that the contact form capturing the data for nms FormMail is told to acept utf-8, for example...
...
<form action="formmail.pl" class="cssform" method="post" accept-charset='utf-8'>
...