Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $headers .= "Content-Type: text/html; charset=UTF-8rn";
- <?php
- $dbhost = 'localhost';
- $dbuser = '###';
- $dbpass = '###';
- $dbname = '###';
- $conn = mysql_connect($dbhost, $dbuser, $dbpass);
- if(!$conn) {
- die('Failed to connect to server: ' . mysql_error());
- }
- mysql_select_db($dbname);
- $sql="SELECT Insured_Name,Expiry_Date FROM transactions
- WHERE MONTH(Expiry_Date) = MONTH(CURDATE()) and YEAR(Expiry_Date) = YEAR(CURDATE())";
- $result = mysql_query($sql)or die("Cannot query orders_products data" . mysql_error());
- $email = "###############";
- $emailto = "############";
- $subject = "List of policies to expire this month";
- $headers .= "MIME-Version: 1.0rn";
- $headers .= "Content-Type: text/html; charset=UTF-8rn";
- $headers = "From: $email";
- // prepare email body text
- $body .= "Here Are A List Of policies to expire this monthnn";
- $body .= "<a href='expired.php'>Download complete list</a>nn";
- $body .='<table width="200" border="1">';
- $body .='<tr>';
- $body .='<td>Insured name</td>';
- $body .='<td>Expiry date</td>';
- $body .='</tr>';
- while($row=mysql_fetch_array($result)) {
- $body .='<tr>';
- $body .='<td>'.$row['Insured_Name'] .'</td>';
- $body .='<td>'.$row['Expiry_Date'] .'</td>';
- $body .='</tr>';
- }
- $body .='</table>';
- $body .= "This is an automated mail from the KBL insurance portalnn";
- // send email
- $send = mail($emailto, $subject, $body, $headers);
- mysql_close($conn);
- // redirect to success page
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement