| 1 | <?PHP |
| 2 | // Pear Mail Library |
| 3 | require_once "Mail.php"; |
| 4 | include_once('/var/www/secure.php'); |
| 5 | |
| 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'); |
| 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>'; |
| 12 | $subject = $sub.' [MD-Petition.com]'; |
| 13 | $body = "$msg <br><br><br><br> Patrick McGuire <br>MD Petition Support mdpetition@gmail.com <br> https://www.md-petition.com "; |
| 14 | |
| 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 | ); |
| 22 | |
| 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 | )); |
| 30 | |
| 31 | $mail = $smtp->send($to, $headers, $body); |
| 32 | |
| 33 | if (PEAR::isError($mail)) { |
| 34 | return $mail->getMessage(); |
| 35 | } else { |
| 36 | return 'NO ERROR'; |
| 37 | } |
| 38 | |
| 39 | } |
| 40 | |