insert_id; //Set Email Info $to = "TO-EMAIL@DOMAIN.COM"; $subject = "New BMS Alert: ".$unitname." ".$alertname.""; $headers = "From: FROM-EMAIL@DOMAIN.COM"; $message = "BMS Unit: ".$unitname." \n Type of Alert: ".$alertname." \n Start Date / Time: ".$start_date_time." \n End Date / Time: ".$end_date_time." \n Description: ".$description." \n Created by: ".$user." \n Event Link: https://DOMAIN.com/bms/viewevent.php?eventid=$event_id \n \n This message generated by https://DOMAIN.com/bms"; //WordWrap the message $message_wrapped = wordwrap($message, 70, "\n", true); //Send the email mail($to,$subject,$message_wrapped,$headers); } else{ echo('Error! Please go back and try again'); } $conn->close(); ?>