Update warning_not_found.php
[clinton/MarylandElectronicPetitionSignature.git] / email.php
dissimilarity index 90%
index d319333..8dd59b1 100644 (file)
--- a/email.php
+++ b/email.php
@@ -1,35 +1,40 @@
-<?PHP
-require_once "Mail.php";
-include_once('/var/www/secure.php');
-
-
-$from = "MD-Petition.com Support <mdpetition@gmail.com>";
-$to = "Patrick <insidenothing@gmail.com>";
-$subject = "Hi!";
-$body = "Hi,\n\nHow are you?";
-
-$host = "smtp.gmail.com";
-$port = "587";
-global $gmail_email_user;
-$username = $gmail_email_user;
-global $gmail_email_pass;
-$password = $gmail_email_pass;
-
-$headers = array ('From' => $from,
-  'To' => $to,
-  'Subject' => $subject);
-$smtp = Mail::factory('smtp',
-  array ('host' => $host,
-    'port' => $port,
-    'auth' => true,
-    'username' => $username,
-    'password' => $password));
-
-$mail = $smtp->send($to, $headers, $body);
-
-if (PEAR::isError($mail)) {
-  echo("<p>" . $mail->getMessage() . "</p>");
- } else {
-  echo("<p>Message successfully sent!</p>");
- }
- ?>
+<?PHP
+// Pear Mail Library
+require_once "Mail.php";
+include_once('/var/www/secure.php');
+
+// 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');
+function meps_mail($to,$msg,$sub){
+    global $gmail_email_user;
+    global $gmail_email_pass;
+    $from = 'MD Petition Support <mdpetition@gmail.com>';
+    //$to = 'Patrick <baltimorehacker@gmail.com>';
+    $subject = $sub.' [MD-Petition.com]';
+    $body = "$msg <br><br><br><br> Patrick McGuire <br>MD Petition Support  mdpetition@gmail.com <br> https://www.md-petition.com ";
+
+    $headers = array(
+        'From' => $from,
+        'To' => $to,
+        'Subject' => $subject,
+        'MIME-Version' => 1,
+        'Content-type' => 'text/html;charset=iso-8859-1'
+    );
+
+    $smtp = Mail::factory('smtp', array(
+            'host' => 'ssl://smtp.gmail.com',
+            'port' => '465',
+            'auth' => true,
+            'username' => $gmail_email_user,
+            'password' => $gmail_email_pass
+        ));
+
+    $mail = $smtp->send($to, $headers, $body);
+
+    if (PEAR::isError($mail)) {
+       return $mail->getMessage();
+    } else {
+       return 'NO ERROR';
+    }
+    
+}
+