S
Supra
Hi,
I'm using the following code to send an email from a form on a PHP page. If
there're unicode characters in message body, they get carried over fine in
the email sent out, however if there are some in the subject or name fields,
they come out as blanks in the email received. Does anyone know how this can
be fixed?
#!/usr/bin/perl
print "Content-Type: text/html\n\n";
use utf8;
use CGI;
$q = new CGI;
unless(open (MAIL, "|/usr/lib/sendmail -t"))
{
warn "Error starting sendmail: $!";
}
else
{
print MAIL "Content-type: text/html\;charset=UTF-8\n";
print MAIL "From: ".$q->param('mail_name')."
<".$q->param('mail_from').">\n";
print MAIL "To: name\@email.com\n" ;
print MAIL "Subject: ".$q->param('mail_subject')."\n\n";
print MAIL $q->param('mail_body');
close(MAIL) || warn "Error closing mail: $!";
}
Many thanks,
Julius
I'm using the following code to send an email from a form on a PHP page. If
there're unicode characters in message body, they get carried over fine in
the email sent out, however if there are some in the subject or name fields,
they come out as blanks in the email received. Does anyone know how this can
be fixed?
#!/usr/bin/perl
print "Content-Type: text/html\n\n";
use utf8;
use CGI;
$q = new CGI;
unless(open (MAIL, "|/usr/lib/sendmail -t"))
{
warn "Error starting sendmail: $!";
}
else
{
print MAIL "Content-type: text/html\;charset=UTF-8\n";
print MAIL "From: ".$q->param('mail_name')."
<".$q->param('mail_from').">\n";
print MAIL "To: name\@email.com\n" ;
print MAIL "Subject: ".$q->param('mail_subject')."\n\n";
print MAIL $q->param('mail_body');
close(MAIL) || warn "Error closing mail: $!";
}
Many thanks,
Julius