-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemail.php
28 lines (25 loc) · 1.09 KB
/
email.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
// helper file to send emails
$title = mysql_real_escape_string($_POST['title']);
$body = mysql_real_escape_string($_POST['body']);
$email = mysql_real_escape_string($_POST['email']);
$clusterManaging = mysql_real_escape_string($_POST['cm']);
$emailbody = "A new DECA ".$clusterManaging." announcement was posted:<br><br>".$title."<br><br>".$body."<br><br>More cluster-wide announcements: www.irhsdeca.com/dashboard.php<br><br>More chapter-wide announcements: www.irhsdeca.com/announcements.php<br><br>- The IRHS DECA Team";
require 'PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = '----------';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('[email protected]', 'IRHS DECA');
$mail->addAddress($email);
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'New DECA Announcement: '. $title;
$mail->Body = $emailbody;
if(!$mail->send()) {
$errMSG = 'Mailer Error: ' . $mail->ErrorInfo;
}
?>