i have a main page that calls my php page to generate the report, then on the same main page, i have a Send Email button which calls my mail php page but its not sending the generated report to the specified email address, how can i make this Send Email button work?
what i want to happen here is that after i generated the report ill send it to email keeping the same table format...
here's my mail php:
<?php
//for getting the variable in the URL
$WirelessRemaining= $_GET['WirelessRemaining'];
$WirelineRemaining = $_GET['WirelineRemaining'];
$dates = $_POST['dates'];
$output= $_POST['$output'];
require 'include/DB_Open.php';
$to = "aa.aa@xy.com";
$subject = "Test, $dates";
$body = "$output";
$headers = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-Type: text/html; charset=ISO-8859-1' . "
";
$headers .= "From: aa <aa.aa@xy@ccc.com>
";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
include 'include/DB_Close.php';
?>
here's the code that calls the report generator and mail php:
$(document).ready(function(){
$("#RetrieveList").on('click',function() {
var xid = $('#XiD').val();
var date = $('#Date').val();
$.post('retrieve_test.php',{xid:xid, date:date}, function(data){
$("#results").html(data);
});
return false;
});
$("#Report").on('click',function() {
var dates = $('#Date').val();
$.post('report_sample.php',{dates:dates}, function(data){
$("#results").html(data);
});
return false;
});
$("#Email").on('click',function() {
var date1 = $('#Date').val();
$.post('mail.php',{date1:date1, output:output}, function(data){
$("#results").html(data);
});
return false;
});
});
$dates = $_POST['dates'];
$output= $_POST['$output'];
should be
$dates = $_POST['date1'];
$output= $_POST['output'];