function sendRegistrationMail($mailAddr, $hash) { $url = "http://www.chicon.fr/chicon/misc/confirmRegistration.php?hash=" . $hash; sendMailFromContact($mailAddr, "Account creation Confirmation", "You have just created an account on Chic'on website\nPlease confirmed your account at :\n\n" . $url . "\n\nThank You\n\n Chic'on Team"); sendMailToContact($mailAddr, "Account Creation", "A new account was created for " . $mailAddr); return true; }
function sendMagicNumberHdwMail($mailAddr, $serial, $mn) { sendMailFromContact($mailAddr, "Hardware assigned - Magic Number", "You have assign an hardware to your account, magic number was generated successfully\n\nSerial : " . $serial . "\nMagic Number: " . $mn . "\n\nThank You\n\n Chic'on Team"); sendMailToContact($mailAddr, "Hardware assigned - Magic Number", "A new hardware was assigned to " . $mailAddr . "\nSerial : " . $serial . "\nMagic Number: " . $mn . "\n"); return true; }
function sendSerialHdwMail($mailAddr, $serial) { sendMailFromContact($mailAddr, "Serial request confirmation", "You have just requested a serial for your hardware\nSerial generated is :" . $serial . "\n\nThank You\n\n Chic'on Team"); sendMailToContact($mailAddr, "Serial request confirmation", "A new serial was generated for " . $mailAddr . "\nSerial : " . $serial); return true; }
$code = generateRandomString(20); $now = date("Y-m-d H:i:s", time()); $query1 = "UPDATE TUSERS SET `Reset Code` = '{$code}', `Reset Time` = '{$now}' WHERE `User ID` = {$userid};"; try { db_query_exception($query1); } catch (Exception $ex) { $desc = "Something went wrong while sending the forgot password email."; returnToPageError($desc); } $origin = $_SERVER["SERVER_NAME"]; $url = "http://{$origin}/forgottenPassword.php?code={$code}"; $subject = "Forgotten password"; $name = "{$firstName} {$surname}"; $body = "<html>\r\n <body>\r\n <p>Hi {$firstName},</p>\r\n <p>You have recently reported a forgotten password.</p>\r\n <p>To reset your password please go to the following <a href='{$url}'>link</a>.</p>\r\n <p>If you did not report a forgotten password then please contact us by replying to this email.</p>\r\n <p>Thanks,<br>Smarkbook</p>\r\n </body>\r\n </html>\r\n "; try { sendMailFromContact($email, $name, $body, $subject); $message = "An email has been sent to {$email} containing a link to reset your password."; returnToPageSuccess($message); } catch (Exception $ex) { $desc = "Something went wrong while sending the forgot password email."; returnToPageError($desc); } } else { if ($type === "RESET") { if (isset($pwd, $code)) { //Check the details match up for the right time $query2 = "SELECT `User ID`, `Reset Code`, `Reset Time` FROM TUSERS WHERE `Email` = '{$email}'"; try { $result2 = db_select_exception($query2); if (count($result2) == 0) { throw new Exception();
<?php include "./mailFunc.php"; $fromAddr = $_POST['fromAddr']; $subject = $_POST['subject']; $mailBody = $_POST['mailBody']; $asm = $_POST['asm']; if (isset($asm) && $asm == '') { sendMailToContact($fromAddr, $subject, $mailBody); sendMailFromContact($fromAddr, "Confirmation", "You have just send a message to the Chic'on Team. We will get back to you as soon as possible!\nThank You\n\n Chic'on Team"); } $result = array("result" => array("code" => 200, "data" => "Message sent")); echo json_encode($result);