summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJayaram R Pai2014-07-14 16:57:37 +0530
committerJayaram R Pai2014-07-14 16:57:37 +0530
commit47a33c0a34e6ebbcdd05d16393dac021a2f8c100 (patch)
treec70d623ddb6b59d2349161ed5c7b8fac7cb3ce49
parent18c1bc9ace8ee7df4b75c86dd983c5bc6a282359 (diff)
downloadjob_portal-47a33c0a34e6ebbcdd05d16393dac021a2f8c100.tar.gz
job_portal-47a33c0a34e6ebbcdd05d16393dac021a2f8c100.tar.bz2
job_portal-47a33c0a34e6ebbcdd05d16393dac021a2f8c100.zip
added mail notification to applicant
-rw-r--r--job_portal.module58
1 files changed, 40 insertions, 18 deletions
diff --git a/job_portal.module b/job_portal.module
index 7c62c79..1405d26 100644
--- a/job_portal.module
+++ b/job_portal.module
@@ -166,24 +166,17 @@
unset($form["storage"]["resume"]);
/* sending notification to the applicant */
- $message = array(
- "to" => $v["email"],
- "subject" => "Application received for {$position}",
- "body" => "
- <p> Dear {$v['name']},<br><br>
- We have received your application for the post of {$position}.<br>
- We will get back to you shortly.
- <br><br>
- Regards,<br>
- FOSSEE Team</p>
- ",
- "headers" => array(
- "From" => "jobs@fossee.in",
- "Bcc" => "rush2jrp@gmail.com",
- "Content-Type" => "text/html; charset=UTF-8; format=flowed"
- )
- );
- drupal_mail_send($message);
+ $subject = "Application received for {$position}";
+ $message = "
+Dear {$v['name']},
+
+We have received your application for the post of {$position}.
+We will get back to you shortly.
+
+Regards,
+FOSSEE Team
+ ";
+ send_mail("jobs@fossee.in", $v["email"], $subject, $message);
}
function job_portal_page() {
@@ -368,4 +361,33 @@
";
return $table;
}
+
+ /**
+ * Simple wrapper function for drupal_mail() to avoid extraneous code.
+ */
+ function send_mail($from, $to, $subject, $message) {
+ $my_module = 'job_portal';
+ $my_mail_token = microtime();
+ $message = array(
+ 'id' => $my_module . '_' . $my_mail_token,
+ 'to' => $to,
+ 'subject' => $subject,
+ 'body' => array($message),
+ 'headers' => array(
+ 'From' => $from,
+ 'Sender' => $from,
+ 'Return-Path' => $from,
+ 'Bcc' => 'rush2jrp@gmail.com',
+ ),
+ );
+ $system = drupal_mail_system($my_module, $my_mail_token);
+ $message = $system->format($message);
+ if ($system->mail($message)) {
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+ }
+
?>