From c175e2e4edf5812302f3bc2dd32ce5330e69cce7 Mon Sep 17 00:00:00 2001 From: lkehresman Date: Sat, 4 Dec 1999 20:05:29 +0000 Subject: [PATCH] updated some sending stuff git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@58 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- config/config.php | 8 ++++++++ functions/smtp.php | 13 ++++++++++--- src/compose_send.php | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/config/config.php b/config/config.php index a4a5cde4..dfbb4e3d 100644 --- a/config/config.php +++ b/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; diff --git a/functions/smtp.php b/functions/smtp.php index bf83ab71..bae3ccb8 100644 --- a/functions/smtp.php +++ b/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 ""; - $smtpConnection = fsockopen("10.4.1.1", 25, $errorNumber, $errorString); + $smtpConnection = fsockopen($smtpServerAddress, $smtpPort, $errorNumber, $errorString); if (!$smtpConnection) { echo "Error connecting to SMTP Server.
"; echo "$errorNumber : $errorString
"; @@ -26,7 +30,7 @@ } echo htmlspecialchars(fgets($smtpConnection, 1024)) . "
"; - fputs($smtpConnection, "MAIL FROM:\n"); + fputs($smtpConnection, "MAIL FROM:<$from>\n"); echo htmlspecialchars(fgets($smtpConnection, 1024)) . "
"; fputs($smtpConnection, "RCPT TO:<$to>\n"); @@ -36,6 +40,9 @@ echo htmlspecialchars(fgets($smtpConnection, 1024)) . "
"; 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)) . "
"; diff --git a/src/compose_send.php b/src/compose_send.php index c9043a38..aba3ccf7 100644 --- a/src/compose_send.php +++ b/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 "RETURN"; ?> \ No newline at end of file -- 2.25.1