Previous Thread
Next Thread
Print Thread
Rate Thread
#102293 02/20/2001 6:08 PM
Joined: Jun 2000
Posts: 4
Junior Member
Junior Member
Offline
Joined: Jun 2000
Posts: 4
I need help getting this code to work with sendmail instead of SMTP, or some one to allow me to use their SMTP server so that I don't even need to change the code.

If you think you would be able to help please let me know and I'll send you some of the code to let you see it so that I can get it fixed.

Thanks!

Sponsored Links
#102294 02/20/2001 8:50 PM
Joined: Jun 2000
Posts: 4
Junior Member
Junior Member
Offline
Joined: Jun 2000
Posts: 4
OK,

here it is what did I do wrong??
PLEASE HELP!!

sub send_me {
# Open The Mail Program

local($totalquant,$totalprice,$totalweight) = 0;

open (MAIL, "|$mailprog -t -f") || print "Can't start mail program";
print MAIL "To: [email protected],$FORM{'email'}n";
print MAIL "From: $FORM{'email'}n";
print MAIL "Subject: $FORM{'subject'}nn";
print MAIL "-----------------------------------------------------------------n";
print MAIL " Thank you for ordering from The Store! nn";
print MAIL " Your order information appears below. If you need n";
print MAIL " to get in touch with us about your order, send an email n";
print MAIL " message to [email protected] nn";
print MAIL " --.com Customer Service n";
print MAIL "------------------------------------------------------------------n";
print MAIL "This is a Online Process.n";
print MAIL "This form was submitted by";
print MAIL " $FORM{'last_name'} $FORM{'last_name'} ($FORM{'email'})n";
print MAIL "on $daten";
print MAIL "----------------------------------------------------------------n";
print MAIL "Buyer info:nn";
print MAIL "Order Number : $index n";
print MAIL "Name: $FORM{'first_name'} $FORM{'last_name'}n";
print MAIL "Address: $FORM{'address'}n";
print MAIL "$FORM{'city'}, $FORM{'state'} ";
print MAIL "$FORM{'zip'}n";
print MAIL "Phone: $FORM{'home_phone'}n";
print MAIL "Credit Card: removen";
print MAIL "Card Number: removen";
print MAIL "Expires: removen";
print MAIL "----------------------------------------------------------------n";
print MAIL "Recipients info:nn";
print MAIL "Name: $FORM{'rfirst_name'}n";
print MAIL "Address: $FORM{'raddress'}n";
print MAIL "$FORM{'rcity'}, $FORM{'rstate'} ";
print MAIL "$FORM{'rzip'}n";
print MAIL "Phone: $FORM{'rhome_phone'}n";
print MAIL "----------------------------------------------------------------nn";
print MAIL "Remote Host: $userhostn";
print MAIL "Buyer Agent: $useragentn";
print MAIL "----------------------------------------------------------------nn";
print MAIL "The purchase is:nn";

print MAIL sprintf "%-14s", "Item ID";
print MAIL sprintf "%-23s", "Item Name";
print MAIL sprintf "%14s", "Item Price";
print MAIL sprintf "%14s", "Quantity";
print MAIL sprintf "%14s", "Totals";
print MAIL "n";
print MAIL "--------------------------------------------------------------------------------n";

for ($i=1;$i<$SIZE;$i++) {
$_ = $LINES[$i];
($itemname, $itemprice, $itemquant, $weight, $itemid) = split(/|/,$_);
$tmpprice = $itemprice*$itemquant;

$_ = $tmpprice;
if (/./) {
($left,$right) = split(/./,$tmpprice);
if (length($right) == 0) {
$tmpprice = $tmpprice . "00";
}
elsif (length($right) == 1) { $tmpprice = $tmpprice . "0"; }
}
else { $tmpprice = $tmpprice . ".00"; }
$totalprice=$totalprice + $tmpprice;
$totalquant=$totalquant + $itemquant;
$totalweight = $totalweight + $weight;

print MAIL sprintf "%-14.14s", "$itemid";
print MAIL sprintf "%-24.24s", $itemname;
print MAIL sprintf "%13.13s", "$$itemprice";
print MAIL sprintf "%10.10s", $itemquant;
print MAIL sprintf "%18.18s", "$$tmpprice";
print MAIL "n";
}#End of for loop

print MAIL "--------------------------------------------------------------------------------n";
print MAIL "Subtotal:";
$_ = $totalprice;
if (/./) {
($left,$right) = split(/./,$totalprice);
if (length($right) == 0) {
$totalprice = $totalprice . "00";
}
elsif (length($right) == 1) { $totalprice = $totalprice . "0"; }
}

else { $totalprice = $totalprice . ".00"; }
print MAIL sprintf "%71s", "$$totalpricen";
#Print shipping from form
$shipamt = "3.50";

print MAIL "Shipping:";
print MAIL sprintf "%71s", "$$shipamtn";
#end of hack

if ($tax){
$tax = $totalprice * $tax;
$_ = $tax;
($tleft, $tright) = split(/./, $tax);
$tright = substr($tright, 0, 2);
$_ = $totalprice;
($left,$right) = split(/./,$totalprice);
if (length($right) == 0 ){
$right = "00";
} elsif (length($right) == 1 ){
$right = $right . "0";
}
$left = $tleft + $left;
$right = $tright + $right;
if ($right > 99) {
$right = $right - 100;
$left = $left + 1;
}
$totalprice = $left.".".$right;
$tax = $tleft . "." . $tright;
print MAIL "Tax:";
print MAIL sprintf "%76s" , "$$taxn";
$tax = 0.0825;
}

#Print total price from form
#$totalprice = $FORM {'total'};


$totalprice = int($totalprice * (10 ** 2) + .5) / (10 ** 2);
$_ = $totalprice;
($left,$right) = split(/./,$totalprice);
if (length($right) == 0 ){
$right = "00";
} elsif (length($right) == 1 ){
$right = $right . "0";
}
$left = 3 + $left;
$right = 50 + $right;
if ($right > 99) {
$right = $right - 100;
$left = $left + 1;
}
$totalprice = $left.".".$right;
$_ = $totalprice;
if (/./) {
($left,$right) = split(/./,$totalprice);
if (length($right) == 0) {
$totalprice = $totalprice . "00";
}
elsif (length($right) == 1) { $totalprice = $totalprice . "0"; }
}
else { $totalprice = $totalprice . ".00"; }

print MAIL "Total Price:";
print MAIL sprintf "%70s" , "$$totalpricennn";
# end of print
if ($CONFIG{'sort'} eq 'alphabetic') {
foreach $key (sort keys %FORM) {
# Print the name and value pairs in FORM array to mail.
print MAIL "$key: $FORM{$key}nn";
}
}
elsif ($CONFIG{'sort'} ne 'alphabetic') {
$CONFIG{'sort'} =~ s/order://;
@sorted_fields = split(/,/, $CONFIG{'sort'});
foreach $sorted_field (@sorted_fields) {
# Print the name and value pairs in FORM array to mail.
if ($FORM{$sorted_field}) {
print MAIL "$sorted_field: $FORM{$sorted_field}nn";
}
}
}
else {
foreach $key (keys %FORM) {
# Print the name and value pairs in FORM array to html.
print MAIL "$key: $FORM{$key}nn";
}
}

$totalprice = 0;
open (REFFILE,"$reffile") || print "Content-type: text/htmlnn Can't Open $reffile(r): $!n";
@LINES=;
close(REFFILE);
$SIZE=@LINES;
print MAIL "----------------------------------------------------------------------------------n";
print MAIL " Will ship using US First Class (please allow 5 -10 business days) n";
print MAIL "----------------------------------------------------------------------------------n";
print MAIL " Note: These charges will appear as on your statement n";
print MAIL "----------------------------------------------------------------------------------n";
close (MAIL);

}


Had to remove personal/ company info.

[ February 20, 2001: Message edited by: RoadWarrior ]

[ February 20, 2001: Message edited by: RoadWarrior ]

#102295 02/21/2001 3:04 AM
Joined: Jan 2000
Posts: 5,073
Admin Emeritus
Admin Emeritus
Joined: Jan 2000
Posts: 5,073
Okay, first, STOP.

Take a look at the script.

Run through it.

Tell me, of all the lines, how many do you understand. Other than print statements, how many could you change and know exactly what you were doing?

Are you asking us for help because:
- You don't know what you're doing
- You think you know what you're doing, but aren't sure of yourself
- You need pointers so you can do it yourself
- You want someone to fix your problems so you don't have to do any of the work yourself

Please be honest when answering that question. tipsy

It should be relatively easy to adapt that script. The key thing being getting SMTP working, of course.

We'll tackle that once you answer the questions I posed above.


UBB.classic: Love it or hate it, it was mine.
#102296 02/21/2001 3:36 PM
Joined: Feb 2000
Posts: 4,625
Member
Member
Offline
Joined: Feb 2000
Posts: 4,625
Not to mention the code is a bit messy. But to proceed with the standard "teach first, show later" method CC is using... wink


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Shock Hosting
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,153
Joined: July 2001
Forum Statistics
Forums63
Topics37,583
Posts293,955
Members13,825
Most Online151,614
Nov 14th, 2025
Today's Statistics
Currently Online 2983
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 15
Top Posters
AllenAyres 21,080
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2026 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20260108)