HTML format for checkout.pl mail output?

Problems installing or using the NOP Design Free Shopping Cart. **ARCHIVE** Please post new topics to one of the groups below.

Moderator: scott

HTML format for checkout.pl mail output?

Postby Michael » Sat Mar 15, 2003 11:52 am

It is possible to format the checkout.pl output mails with HTML codes?

I've tried a couple of experiments which haven't worked so I'm guessing that the answer is a no, no.
Obviously if we could it would make mail responses to clients much prettier! And our orders more readable.

Here's there experiment I tried, and got server error messages.

open (MAIL,"|$mailprogram");
print MAIL "Content-Type: text/html\n\n";
print MAIL "<HTML><HEAD></HEAD><BODY>";
print MAIL "<B>Test Text</B><BR>";
print MAIL "</BODY></HTML>";

:roll:
http://www.sterling-bond.com - Escrow merchant accounts. Creating A World Of Trust.
"/" Stroke, what you do to make a woman happy.
"\" Backstroke, what you do to a woman after you've made her happy.
Michael
 
Posts: 80
Joined: Fri Aug 09, 2002 10:18 pm
Location: UK

Yes You Can

Postby Michael » Sun Mar 16, 2003 12:48 pm

Yes it can be done, I spotted a few glitches with my code and a couple of test runs are working.

Now working on a fuller script, complete with table...

Coming in next few hours (I hope).

8)
http://www.sterling-bond.com - Escrow merchant accounts. Creating A World Of Trust.
"/" Stroke, what you do to make a woman happy.
"\" Backstroke, what you do to a woman after you've made her happy.
Michael
 
Posts: 80
Joined: Fri Aug 09, 2002 10:18 pm
Location: UK

Play Time

Postby Michael » Sun Mar 16, 2003 1:34 pm

:lol:

Okay, here's one version for you to study and play around with.
I'm only using the checkout.pl for an email response system on this site so I haven't included any script for the shopping output; but I have included a table for you to see how you can lay out your own results tables, one row per product item.


NOTES:-
1) The top of the script containes the email elements and subject outside the HTML.
2) Where the plain .pl script uses \n for new line you would replace this within the HTML by either <P> or <BR> tags.
3) If a tag is a quoted one, such as <a href="my_path">My Site is ded good.</a> then escape the quotes, thus: <a href=\"my_path\">....blah, blah, blah.
4) You can use the <HR> tag to insert separation lines for your responses.
5) And you get to add a working link to a remotely stored graphic to pretty it up!

#
# Send email conformation to the client.....
#(Test HTML VERSION, Michael Bond 2003)
#
open (MAIL,"|$mailprogram");
print MAIL "To: $b_email\n";
print MAIL "From: $youremail\n";
print MAIL "Subject: Sterling-Bond Client Account Registration.\n";
print MAIL "Content-Type: text/html\n\n";
print MAIL "<HTML><HEAD></HEAD><BODY>";
print MAIL "<P><B>Subject: Sterling-Bond Client Account Registration.</B><BR>";
print MAIL "<P>Thank you for your account registration. <BR>";
print MAIL "I hope that you will find our services are an excellent way to<BR>";
print MAIL "protect your transactions around the world. <BR>";
print MAIL "<P>Regards,<BR>";
print MAIL "Michael Bond<BR>";
print MAIL "Director, Sterling-Bond<BR>";
print MAIL "<P>www.sterling-bond.com<BR>";
print MAIL "mail\@sterling-bond.com<BR>";
print MAIL "<BR>";
print MAIL "--------<BR>";
print MAIL "A summary of your details appears below<BR>";
print MAIL "Date: $day, $months[$month], $year $hour:$min:$sec<BR>";
print MAIL " <BR>";
print MAIL "Client:<BR>";
print MAIL "--------<BR>";
print MAIL " Type of Client: $a_type<BR>";
print MAIL " $a_businessname<BR>";
print MAIL " $a_first $b_last<BR>";
print MAIL " $a_addr<BR>";
print MAIL " $a_email<BR>";
print MAIL "--------<BR>";
print MAIL "<a href=\"http:\\\\www.sterling-bond.com\">Sterling-Bond - Creating A World Of Trust</a><BR>";

print MAIL "-------- <BR>";

if ( $s_addr eq "" ) {
print MAIL " Use Contact Address<BR>";
} else {
print MAIL " $s_first $s_last <BR>";
print MAIL " $s_addr <BR>";
print MAIL " $s_addr2 <BR>";
print MAIL " $s_city, $s_state $s_zip <BR>";
print MAIL " $s_phone <BR>";
}
print MAIL "<TABLE width=\"400\"><TR><TD colspan=\"2\" bgcolor=\"silver\"><B>Your Confidential Details are:- </B></TD></TR>";
print MAIL "<TR><TD width=\"150\">Detail 1:</TD><TD>$a_1</TD></TR>";
print MAIL "<TR><TD width=\"150\">Detail 2:</TD><TD>$a_2</TD></TR>";
print MAIL "<TR><TD width=\"150\">Detail 3:</TD><TD>$a_3</TD></TR>";
print MAIL "</TABLE>";
print MAIL "<HR>";
print MAIL "<B>Comments: </B><BR>";
print MAIL "$comment";
print MAIL "<P><img src=\"http://www.sterling-bond.com/Pics/S-Bthumb.jpg\" align=\"right\"><BR>";
print MAIL "</BODY></HTML>";
close MAIL;

The following is how the order element may look. NOTE: I haven't tested this element, so be careful with what I've suggested.

print MAIL "<TABLE><TR><TD>Qty</TD><TD>Price (£)</TD><TD>ProductID</TD><TD>ProductName</TD></TR>";
print MAIL "<TR><TD>$QUANTITY_1</TD><TD>£$PRICE_1</TD><TD>$ID_1 - $NAME_1</TD><TD>$ADDTLINFO_1</TD></TR>";
if( $NAME_2 ) {print MAIL "<TR><TD>$QUANTITY_2</TD><TD>£$PRICE_2</TD><TD>$ID_2 - $NAME_2</TD><TD>$ADDTLINFO_2</TD></TR>";}
if( $NAME_3 ) {print MAIL "<TR><TD>$QUANTITY_3</TD><TD>£$PRICE_3</TD><TD>$ID_3 - $NAME_3</TD><TD>$ADDTLINFO_3</TD></TR>";}
print MAIL "</TABLE>";

Obviously you can add decorative elements such as borders, shading, etc., as required to improve readibility.

8)
http://www.sterling-bond.com - Escrow merchant accounts. Creating A World Of Trust.
"/" Stroke, what you do to make a woman happy.
"\" Backstroke, what you do to a woman after you've made her happy.
Michael
 
Posts: 80
Joined: Fri Aug 09, 2002 10:18 pm
Location: UK


Return to Installation and Setup Problems

Who is online

Users browsing this forum: No registered users and 1 guest

cron