Commit | Line | Data |
---|---|---|
5c66ac11 | 1 | <?PHP |
46790afe | 2 | // Pear Mail Library |
5c66ac11 PM |
3 | require_once "Mail.php"; |
4 | include_once('/var/www/secure.php'); | |
5c66ac11 | 5 | |
0e16018c | 6 | // USAGE meps_mail('Patrick <baltimorehacker@gmail.com>','I just wanted to take a second and follow up with your visit to md-petition.com and see if you needed anything, or had any questions.','Petition Follow-Up'); |
a52532ef PM |
7 | function meps_mail($to,$msg,$sub){ |
8 | global $gmail_email_user; | |
9 | global $gmail_email_pass; | |
10 | $from = 'MD Petition Support <mdpetition@gmail.com>'; | |
11 | //$to = 'Patrick <baltimorehacker@gmail.com>'; | |
5d9a356a | 12 | $subject = $sub.' [MD-Petition.com]'; |
a52532ef | 13 | $body = "$msg <br><br><br><br> Patrick McGuire <br>MD Petition Support mdpetition@gmail.com <br> https://www.md-petition.com "; |
46790afe | 14 | |
a52532ef PM |
15 | $headers = array( |
16 | 'From' => $from, | |
17 | 'To' => $to, | |
18 | 'Subject' => $subject, | |
19 | 'MIME-Version' => 1, | |
20 | 'Content-type' => 'text/html;charset=iso-8859-1' | |
21 | ); | |
46790afe | 22 | |
a52532ef PM |
23 | $smtp = Mail::factory('smtp', array( |
24 | 'host' => 'ssl://smtp.gmail.com', | |
25 | 'port' => '465', | |
26 | 'auth' => true, | |
27 | 'username' => $gmail_email_user, | |
28 | 'password' => $gmail_email_pass | |
29 | )); | |
5c66ac11 | 30 | |
a52532ef | 31 | $mail = $smtp->send($to, $headers, $body); |
5c66ac11 | 32 | |
a52532ef | 33 | if (PEAR::isError($mail)) { |
13d3ff0f | 34 | return $mail->getMessage(); |
a52532ef | 35 | } else { |
13d3ff0f | 36 | return 'NO ERROR'; |
a52532ef | 37 | } |
13d3ff0f | 38 | |
46790afe | 39 | } |
a52532ef | 40 |