I'm seeking collaboration in adjusting the perl checkout script to use MIme encodings, rather than
- Code: Select all
$mailprogram = "/usr/bin/sendmail -t";
Because the native character set of email is 7-bit ASCII. If you want to use anything else, like British £ signs, you need to use MIME, declare the character set (usually UTF-8), and encode the UTF-8 chars into 7-bit ASCII (probably using quoted-printable).
There are various Perl modules to help with that, Email::MIME::Creator seems the best. http://search.cpan.org/~rjbs/Email-MIME-Creator/lib/Email/MIME/Creator.pm
I'm using the Kamya Perl script and need to rewrite it with specific Mime::Creator instructions, with various if clauses.
Here's a basic single part Mime::Creator script which works:
- Code: Select all
#!/usr/bin/perl
use Email::MIME::Creator;
use Email::Send;
$b_email = 'somebody@example.com';
$youremail = 'service@theloo.co.uk';
my $email = Email::MIME->create(
header => [
From => $b_email,
To => $youremail,
Subject => 'New Online Order',
],
attributes => {
content_type => "text/plain",
charset => "UTF-8",
},
body => <<"END_MESSAGE" );
A new order has been received, summary below.
The body should be just one big string.
etc...
END_MESSAGE
Email::Send->new({mailer => 'Sendmail'})->send($email);
Incorporating multi parts (check the website above) is probably the way to go, because using the basic script, in a trial like below doesn't appear to work:
- Code: Select all
if ( ( $payment_method eq "Credit Card" ) || ( $payment_method eq "PayPal" ) ) {
body => <<"END_MESSAGE" );
A new order has been received, summary below. £="£" you order.
body should be just one big string.
Your order will be despatched with delivery confirmation. \n
"Payment for your order may be made through Check or Money Order, in UK Sterling ( ) or Euros only.";
print "<br />";
print
"Please make checks payable to:<br /><em>ANYONE</em>";
* Orders will be posted upon receipt of payment. \n
* We shall further confirm dispatch by post of your purchase, subject to bank clearing. \n
\n
Please contact us at $youremail if you have any questions or concerns. \n
\n
END_MESSAGE
}
Help by way of collaboration is welcome, if you have experience in this area of multipart message and Mime, plus nopcart.
I'm pretty sure such a script wold be useful to others.
JOhn
