Forum Moderators: coopster
I want to send an email using the php mail() function at the same time as the paymate link is submitted.
The Paymate link looks like this:
<a onclick='self.name = 'parent';' target='_top' href='https://www.paymate.com.au/PayMate/ExpressPayment?mid=myid&amt=$totalprice&pmt_sender_email=$email&popup=false&return=http://www.example.com/'>
<button>Proceed to Payment</button></a>
I've tried using Mail() and then:
header("Location: http://www.example.com/");
exit;
But it causes an error at the Paymate processing page.
Any ideas?
<a onclick='self.name = 'parent';' target='_top' href="?pay=payment" ><button>Proceed to Payment</button></a>
<?php
if($_GET["pay"] == "payment")
mail(...);
header("Location: [paymate.com.au...]
This should do.
Michal Cibor
If anyone else wants to do the same trick, this code works nicely:
if ((isset($_POST['order'])) && ($paymentmethod=='cc'))
{$subject = 'Order Confirmation';
$message = "Dear $name\n\n".
"Thank you for your order.\n\n".
"Order Type: " . $type."\n".
"Number of Copies: " . $numberofcopies."\n".
"Price: $" . sprintf("%01.2f", $totalprice)."\n".
"Payment Method: " . "Credit Card\n".
"Contact Name: " . $contactname."\n".
"Address: " . $deliveryaddress ."\n".$town." ".$state_id." ".$postcode." ".$country_id ."\n".
"Email: " . $email."\n".
"Phone: " . $phone."\n".
"Comments: " . $comments;
$headers = "From: 'My Business'<mybusiness@example.com>\r\n" .
"to: '$contactname' <$email>" . "\r\n" .
"bcc: <mybusiness@example.com>" . "\r\n" .
"Reply-To: 'My Business'<mybusiness@example.com>\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);header("Location: [paymate.com.au...]
}