Commit | Line | Data |
---|---|---|
e761d078 PM |
1 | <?PHP |
2 | include_once('/var/www/secure.php'); | |
3 | ||
4 | function off_world_mail($to,$subject,$body){ | |
5 | if ($to == ''){ | |
6 | die(); | |
7 | } | |
8 | global $aws_email_user; | |
9 | global $aws_email_pass; | |
10 | $to .= ',baltimorehacker@gmail.com'; | |
11 | $subject = str_replace('*','',$subject); | |
12 | $from = "McGuire <baltimorehacker@gmail.com>"; | |
13 | require_once "Mail.php"; | |
14 | $headers = array( | |
15 | 'From' => $from, | |
16 | 'To' => $to, | |
17 | 'Cc' => $cc, | |
18 | 'Subject' => $subject, | |
19 | 'MIME-Version' => 1, | |
20 | 'Content-type' => 'text/html;charset=iso-8859-1' | |
21 | ); | |
22 | $smtp = Mail::factory('smtp', array( | |
23 | 'host' => 'ssl://email-smtp.us-east-1.amazonaws.com', | |
24 | 'port' => '465', | |
25 | 'auth' => true, | |
d5d889c9 PM |
26 | 'username' => "$aws_email_user", |
27 | 'password' => "$aws_email_pass" | |
e761d078 PM |
28 | )); |
29 | $pos = strpos($to,','); | |
30 | if ($pos !== false){ | |
31 | $to_array = explode(',',$to); | |
32 | foreach ($to_array as $group_member) { | |
33 | ||
34 | $mail = $smtp->send(trim($group_member), $headers, $body); | |
35 | } | |
36 | }else{ | |
37 | ||
38 | $mail = $smtp->send($to, $headers, $body); | |
39 | } | |
40 | ||
41 | $mail = $smtp->send($cc, $headers, $body); | |
42 | if (PEAR::isError($mail)) { | |
43 | ||
44 | die($mail->getMessage()); | |
45 | } | |
46 | } | |
47 | ||
48 | ||
49 | function off_world_attach($to,$subject,$body,$file){ | |
50 | global $aws_email_user; | |
51 | global $aws_email_pass; | |
52 | require_once "Mail.php"; // PEAR Mail package | |
53 | require_once ('Mail/mime.php'); // PEAR Mail_Mime packge | |
54 | $from = "McGuire <baltimorehacker@gmail.com>"; | |
55 | $headers = array ('From' => $from,'To' => $to, 'Subject' => $subject); | |
56 | ||
57 | // text and html versions of email. | |
58 | $text = strip_tags($body); | |
59 | $html = $body; | |
60 | ||
61 | // attachment | |
62 | $crlf = "n"; | |
63 | ||
64 | $mime = new Mail_mime($crlf); | |
65 | $mime->setTXTBody($text); | |
66 | $mime->setHTMLBody($html); | |
67 | $mime->addAttachment($file); | |
68 | ||
69 | $body = $mime->get(); | |
70 | $headers = $mime->headers($headers); | |
71 | ||
72 | $smtp = Mail::factory('smtp', array( | |
73 | 'host' => 'ssl://email-smtp.us-east-1.amazonaws.com', | |
74 | 'port' => '465', | |
75 | 'auth' => true, | |
d5d889c9 PM |
76 | 'username' => "$aws_email_user", |
77 | 'password' => "$aws_email_pass" | |
e761d078 PM |
78 | )); |
79 | ||
80 | $mail = $smtp->send($to, $headers, $body); | |
81 | ||
82 | if (PEAR::isError($mail)) { | |
83 | echo("<p>" . $mail->getMessage() . "</p>"); | |
84 | } else { | |
85 | echo("<p>Message successfully sent!</p>"); | |
86 | } | |
87 | } | |
88 | ?> |