Skip to content

Instantly share code, notes, and snippets.

@inaseem
Last active November 17, 2019 16:25
Show Gist options
  • Save inaseem/8ac468335c25f32f0dc2d1a7741e1183 to your computer and use it in GitHub Desktop.
Save inaseem/8ac468335c25f32f0dc2d1a7741e1183 to your computer and use it in GitHub Desktop.
<?php
define("DATABASE", "ats_db");
define("HOST", "localhost");
define("USER", "username");
define("PASSWORD", "password");
error_reporting(E_ERROR | E_PARSE);
$ticketNumber = filter_input(INPUT_POST, 'ticketNumber');
$recipientEmail = filter_input(INPUT_POST, 'toemail');
$emailSubject = "Chalan Receipt for Ticket Number: ".$ticketNumber;
$emailContext = filter_input(INPUT_POST, 'body');
$emailHeaders = "Cc: myemail@gmail.com" . "\r\n";
// $emailHeaders .= "Bcc: Replace email address" . "\r\n";
$fromAddress = "-fpostmaster@localhost";
$emailStatus = mail($recipientEmail, $emailSubject, $emailContext, $emailHeaders, $fromAddress);
if($emailStatus) {
echo "success";
} else {
echo "fail";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment