Forum Moderators: coopster

Message Too Old, No Replies

Paymate and mail()

Need to send myself an email on Paymate submission

         

mrnoisy

4:20 am on Jun 27, 2005 (gmt 0)

10+ Year Member



I'm using Paymate for credit card processing.

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?

mcibor

8:56 am on Jun 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can try first sending mail and then redirecting to Payment:

<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

mrnoisy

10:41 am on Jun 28, 2005 (gmt 0)

10+ Year Member



Well that worked a treat, thanks!

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...]
}