function SendQuizResponseMail($quizId, $assId, $menteeId, $menteeEmail, $givenAns, $ans, $correct) { $resp = "-1"; $givenAnswers = json_decode($givenAns, true); //$correctAnswers = json_decode($ans, true); $correctAnswers = $ans; $mentee = GetMenteeDetailsByEmail($menteeEmail); try { $subject = "Quiz Submitted - Mentored-Research"; $msg = "Dear " . $mentee["MenteeName"] . ","; $msg .= "You have submitted your Quiz(" . GetQuizNameById($quizId) . ") in the assignment(" . GetAssignmentName($assId) . "). <br /> "; $msg .= "<b>Your score is: " . $correct . "</b><br /><br />"; $msg .= "The answers given by you were: <br />1. " . $givenAnswers[0] . "<br />2. " . $givenAnswers[1] . "<br />3. " . $givenAnswers[2] . "<br />4. " . $givenAnswers[3] . "<br />5. " . $givenAnswers[4] . "<br /><br />"; $msg .= "The correct answers are: <br />1. " . $correctAnswers[0] . "<br />2. " . $correctAnswers[1] . "<br />3. " . $correctAnswers[2] . "<br />4. " . $correctAnswers[3] . "<br />5. " . $correctAnswers[4] . "<br /><br />"; $msg .= "Please contact your mentor in case of any doubts.<br /><br />"; $msg .= "Team Mentored-Research<br />"; $msg .= "info@mentored-research.com<br /><br />"; $msg .= "Please do not reply to this automated mail.<br /><br />"; //write the mail sending if else condition here. $res = SendMessage($menteeEmail, $mentee["MenteeName"], "*****@*****.**", "Mentored-Research", $subject, $msg); return $res; } catch (Exception $e) { $resp = "-1"; return $resp; } }
function SendMessageFromMenteeToMentor($toEmail, $msg, $email) { $mentorArr = GetMentorDetailsByEmail($toEmail); $menteeArr = GetMenteeDetailsByEmail($email); // mentor names and email address $mentorEmail = $mentorArr["MentorEmail"]; $mentorName = $mentorArr["MentorName"]; // mentee name and email address $menteeEmail = $menteeArr["MenteeEmail"]; $menteeName = $menteeArr["MenteeName"]; $subject = $menteeName . " - Query Received"; $message = "Dear " . $mentorName . "<br /><br />"; $message .= "You have Received a query from one of your mentees, namely " . $menteeName . " (" . $menteeEmail . "). Please repond to him either privately or through the <a href='http://mentored-research.com/login' target='_blank'>MR-Portal</a> <br /><br />"; $message .= $msg . "<br /><br />"; $message .= "Team Mentored-Research<br />"; $message .= "info@mentored-research.com<br /><br />"; $message .= "Please do not reply to this automated mail.<br />"; $res = SendMessage($mentorEmail, $mentorName, $menteeEmail, $menteeName, $subject, $message); if ($res == "-1") { echo $res; } else { header('Content-Type: application/json'); echo json_encode($res); } }