help with order form mail

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
prasitc2005
Forum Commoner
Posts: 42
Joined: Thu Jul 13, 2006 7:14 am

help with order form mail

Post by prasitc2005 »

Hi

I would rather avoid swiftmail as I have my own code to cope. I think I'm getting closer.


From this code,

Code: Select all

$mailto = "orders@ourdomain.com"; 
$subject = "Web Order"; 
  
$body  = "The following confirms the details of your order:\n"; 
$body .= "\n\n"; 
$body .= "Name: " . $Name . "\n"; 
$body .= "Email: " . $Email . "\n"; 
$body .= "Other Contact Info: " . $OtherInfo . "\n"; 
$body .= "\n\n"; 
$body .= "Class A Widgets: (" . $qtyA . " * 1.25) = " . $totalA . "\n"; 
$body .= "Class B Widgets: (" . $qtyB . " * 2.35) = " . $totalB . "\n"; 
$body .= "Class C Widgets: (" . $qtyC . " * 3.45) = " . $totalC . "\n"; 
$body .= "\n"; 
$body .= "TOTALS: " . $GrandTotal . "\n"; 
  
mail($mailto, $subject, $body); 
mail($Email, $subject, $body);
In this code, the mail got sent exactly the same copy to both email recipients.
The problem is that I want to send $mailto different subject and body from $Email. (eg, we want to send product code or credit card number to our own staff but we don't want a client to see our product code or his credit card number). Also I want the headers to be different so that when we get an e-mail from a client we can reply automaticly.

Please help!

User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Post by Zoxive »

You aren't showing us where Email is coming from and you say you dont want to send each mail the same data?

Then why are you using the same exact variables?

Code: Select all

mail($mailto, $subject, $body);
mail($Email, $subject, $body);
The code is doing as exactly as you are telling it to.
User avatar
prasitc2005
Forum Commoner
Posts: 42
Joined: Thu Jul 13, 2006 7:14 am

Post by prasitc2005 »

The main problem is that I got blocked by gmail when sent the mail scripts to. Is there a way in if statement I can tell the mail to send spefific headers and message to specific email recipient? oh, $email is post from order form

a@test.com
headers:B Sales Deaprtment b@test.com
message: thanks you for buying b products

b@test.comhis
reply to: a@test.com
headers: Client a@test.com
message: here's his order id
his credit card number
his order id
his order items
our inter product code for the item is:

etc,
Post Reply