-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmailer.php
More file actions
36 lines (29 loc) · 921 Bytes
/
mailer.php
File metadata and controls
36 lines (29 loc) · 921 Bytes
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
29
30
31
32
33
34
35
<?php
include('./class.phpmailer.php');
function mailer($from, $from_email, $to, $to_email, $subject, $content, $files) {
$content = nl2br($content);
$mail = new PHPMailer(true);
$mail->IsSendmail();
try {
$mail->CharSet = "utf-8";
$mail->Encoding = "base64";
$mail->AddAddress($to_email, $to);
$mail->SetFrom($from_email, $from);
$mail->AddReplyTo($from_email, $from);
$mail->Subject = $subject;
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
$mail->MsgHTML($content);
if($files[1] != "") $mail->AddAttachment("./temp/".$files[1]);
if($files[2] != "") $mail->AddAttachment("./temp/".$files[2]);
if($files[3] != "") $mail->AddAttachment("./temp/".$files[3]);
$mail->Send();
return true;
} catch (phpmailerException $e) {
echo $e->errorMessage();
return false;
} catch (Exception $e) {
echo $e->getMessage();
return false;
}
}
?>