Преглед на файлове

updated some sending stuff

Luke Ehresman преди 25 години
родител
ревизия
e902308409
променени са 3 файла, в които са добавени 19 реда и са изтрити 4 реда
  1. 8 0
      config/config.php
  2. 10 3
      functions/smtp.php
  3. 1 1
      src/compose_send.php

+ 8 - 0
config/config.php

@@ -9,6 +9,14 @@ $org_name = "Operation Mobilization";
 $imapServerAddress = "adam.usa.om.org";
 $imapPort = 143;
 
+/* The domain where your email address is.  
+ * EX:  in "luke@usa.om.org", usa.om.org is the domain.
+ * this is for all the messages sent out.  Reply address
+ * is generated by $username@$domain
+ */
+$domain = "usa.om.org";
+
+/* Your SMTP server and port number (usually the same as the IMAP server) */
 $smtpServerAddress = "adam.usa.om.org";
 $smtpPort = 25;
 

+ 10 - 3
functions/smtp.php

@@ -16,9 +16,13 @@
       }
    }
 
-   function sendMessage($to, $subject, $body) {
+   function sendMessage($smtpServerAddress, $smtpPort, $to, $subject, $body) {
+      $to = addslashes($to);
+      $body = addslashes($body);
+      $from = "$username@$domain";
+
       echo "<FONT FACE=\"Arial,Helvetica\">";
-      $smtpConnection = fsockopen("10.4.1.1", 25, $errorNumber, $errorString);
+      $smtpConnection = fsockopen($smtpServerAddress, $smtpPort, $errorNumber, $errorString);
       if (!$smtpConnection) {
          echo "Error connecting to SMTP Server.<br>";
          echo "$errorNumber : $errorString<br>";
@@ -26,7 +30,7 @@
       }
       echo htmlspecialchars(fgets($smtpConnection, 1024)) . "<BR>";
 
-      fputs($smtpConnection, "MAIL FROM:<luke@usa.om.org>\n");
+      fputs($smtpConnection, "MAIL FROM:<$from>\n");
       echo htmlspecialchars(fgets($smtpConnection, 1024)) . "<BR>";
 
       fputs($smtpConnection, "RCPT TO:<$to>\n");
@@ -36,6 +40,9 @@
       echo htmlspecialchars(fgets($smtpConnection, 1024)) . "<BR>";
 
       fputs($smtpConnection, "Subject: $subject\n");
+      fputs($smtpConnection, "Date: " . date() . "\n");
+      fputs($smtpConnection, "To: <$to>\n");
+      fputs($smtpConnection, "From: <$from>\n");
       fputs($smtpConnection, "$body\n");
       fputs($smtpConnection, ".\n");
       echo htmlspecialchars(fgets($smtpConnection, 1024)) . "<BR>";

+ 1 - 1
src/compose_send.php

@@ -5,6 +5,6 @@
    include("../functions/mailbox.php");
    include("../functions/smtp.php");
 
-   sendMessage($passed_to, $passed_subject, $passed_body);
+   sendMessage($smtpServerAddress, $smtpPort, $passed_to, $passed_subject, $passed_body);
    echo "<A HREF=\"right_main.php\">RETURN</A>";
 ?>