$mail->FromName = 'Parakh System'; $mail->addAddress($to); // Add a recipient // Name is optional $mail->addReplyTo('*****@*****.**', 'Parakh System'); $mail->addBCC('*****@*****.**'); // Optional name $mail->isHTML(true); // Set email format to HTML $mail->Subject = $subject; $mail->Body = $message; if (!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent'; } } //echo phpinfo(); /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ $subject = "Parakh - Aarya has rated you "; $message = "Dear Team Member<br />"; $message .= "Thanks, <br />"; $message .= "Parakh Team"; $to = "*****@*****.**"; smtp_send_mail($to, $subject, $message);
<?php $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; if ($name != NULL && $email != NULL) { $regex = '/^[a-z0-9!#$%&\'*+\\/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&\'*+\\/=?^_`{|}~-]+)*@(?:[-_a-z0-9][-_a-z0-9]*\\.)*(?:[a-z0-9][-a-z0-9]{0,62})\\.(?:(?:[a-z]{2}\\.)?[a-z]{2,})$/i'; $str = $email; if (preg_match($regex, $str)) { //mail require_once "mail/send.php"; $destAddress = $email; $subject = $name . ' O (∩_∩) O Thank you.'; $content = 'Your message has been added to the database.The message: ' . $message . '<br/>Thank you!'; $fromName = "Chen Hongwei"; smtp_send_mail($destAddress, $subject, $content, $fromName); //mail echo "<script>alert('Message success! The system will send an Email to your mailbox.');location='index.html';</script>"; } else { echo "<script>alert('Please enter a correct email');location='./#contact';</script>"; } }
function notifyRequestStatus($data, $status) { $request_status = $status == 'approve' ? 'approved' : 'declined'; $rating = $request_status == 'approved' ? '+1' : '-1'; $userObj = new rating(); $lead_name = $userObj->get_user_full_name($data['user_id']); $team_member_name = $userObj->get_user_full_name($data['team_member']); $to['name'] = $team_member_name; $team_member_name = explode(" ", trim($team_member_name)); $team_member_name = $team_member_name[0]; $subject = EMAIL_SUBJECT_RESPONSE . $request_status . '!'; $message = 'Hi ' . $team_member_name . ',' . NEWLINE; $comment = isset($data['comment']) && !empty($data['comment']) ? ' with reason: <i>' . $data['comment'] . '</i>.' : '.'; $message .= 'Your request has been ' . $request_status . '.' . NEWLINE . " Login to <a href='" . SITE_URL . "'>" . SITE_NAME . '</a> to view details.' . NEWLINE; $message .= NEWLINE; $message .= EMAIL_FOOTER; $to['email'] = $userObj->get_user_email($data['team_member']); if (ENVIRONMENT != 'LIVE') { $to['email'] = TM_EMAIL; } smtp_send_mail($to, $subject, $message); }