1.11M Members

How to creaye a PHP Email sent IF APPROVED script?

 
0
 

First off, hey everyone just want to let you know I am still very novice when it comes to PHP. Ok so first I will tell you what I am using:

I have created a donation form in php that is integrated with authorize.net. I have a processpayment.php that will either send a user to a approved.php or denied.php page.

So in my processpayment.php file I have the following "if statement that will either send a user to approved.php/denied.php page:

if($response->IsApproved())
		{
			header("Location: " . $GatewaySettings['PaymentApprovedPage']);
		}

else
			header("Location: " . $GatewaySettings['PaymentDeniedPage'] . "?gateway_error=" . rawurlencode($response->GetField("ResponseReasonText")));
	}
	else
			header("Location: " . $GatewaySettings['PaymentDeniedPage'] . "?gateway_error=" . rawurlencode($transaction->GetErrorString($errorCode)));

?>

Ok so you instead of just going to the 'PaymentApprovedPage' upon approval I would like it to send an email to my client from the form and then go to 'PaymentApprovedPage'. So how would I have two php files upon approval like: someone presses submit and then the action is processpayment.php then it goes to sendmail.php and then go to approved.php (which is 'PaymentApprovedPage')

 
0
 

You probably guessed but I meant create and not creaye

 
1
 

You probably guessed but I meant create and not creaye

Hi Drew,

Everyone makes spelling mistakes :P

if($response->IsApproved()) {
	$eol = "\r\n";
	$to = ""; //the recipitant
	$subject = ""; // the subject
	$message = ""; // the thank you message
	$headers = "From: Drew Park <no-reply@your-domain>$eol";
	
	if(@mail($to, $subject, $message, $headers)) {
		header("Location: " . $GatewaySettings['PaymentApprovedPage']);
	}
}

else {
	header("Location: " . $GatewaySettings['PaymentDeniedPage'] . "?gateway_error=" . rawurlencode($response->GetField("ResponseReasonText")));
}

else {
	header("Location: " . $GatewaySettings['PaymentDeniedPage'] . "?gateway_error=" . rawurlencode($transaction->GetErrorString($errorCode)));
}
?>
 
0
 

I really appreciate any help I can get! I sometimes struggle with code and I have no one to turn to because I have no coding friends. So once again thank you : )

Hi Drew,

Everyone makes spelling mistakes :P

if($response->IsApproved()) {
	$eol = "\r\n";
	$to = ""; //the recipitant
	$subject = ""; // the subject
	$message = ""; // the thank you message
	$headers = "From: Drew Park <no-reply@your-domain>$eol";
	
	if(@mail($to, $subject, $message, $headers)) {
		header("Location: " . $GatewaySettings['PaymentApprovedPage']);
	}
}

else {
	header("Location: " . $GatewaySettings['PaymentDeniedPage'] . "?gateway_error=" . rawurlencode($response->GetField("ResponseReasonText")));
}

else {
	header("Location: " . $GatewaySettings['PaymentDeniedPage'] . "?gateway_error=" . rawurlencode($transaction->GetErrorString($errorCode)));
}
?>
 
0
 

I really appreciate any help I can get! I sometimes struggle with code and I have no one to turn to because I have no coding friends. So once again thank you : )

did it work?

Question Answered as of 4 Years Ago by diskhub
 
0
 

I just want to ask if their is someone knew what to do in order to create codes that will make the customer will know that their ordered products are have been approved by the admin. Thankyou and Godbless.

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: