summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-11-04 13:37:42 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-11-04 13:37:42 +0800
commit35b6ec95763aab201ba98efcf547078e765a7217 (patch)
treec19a0436a540714d2dcf47a748f1af02acf377d3
parente8b48976c41bd051144b7ede4462060ecf3aebaf (diff)
downloadpttbbs-35b6ec95763aab201ba98efcf547078e765a7217.tar
pttbbs-35b6ec95763aab201ba98efcf547078e765a7217.tar.gz
pttbbs-35b6ec95763aab201ba98efcf547078e765a7217.tar.bz2
pttbbs-35b6ec95763aab201ba98efcf547078e765a7217.tar.lz
pttbbs-35b6ec95763aab201ba98efcf547078e765a7217.tar.xz
pttbbs-35b6ec95763aab201ba98efcf547078e765a7217.tar.zst
pttbbs-35b6ec95763aab201ba98efcf547078e765a7217.zip
use bbs.h, add Message-ID
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@1292 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/util/outmail.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/pttbbs/util/outmail.c b/pttbbs/util/outmail.c
index 262c3a67..10a7b6f9 100644
--- a/pttbbs/util/outmail.c
+++ b/pttbbs/util/outmail.c
@@ -1,20 +1,5 @@
/* $Id$ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/file.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include "config.h"
-#include "pttstruct.h"
-
+#include "bbs.h"
#define SPOOL BBSHOME "/out"
#define INDEX SPOOL "/.DIR"
@@ -84,7 +69,11 @@ void disconnectMailServer(int sock) {
void doSendBody(int sock, FILE *fp, char *from, char *to, char *subject) {
int n;
char buf[2048];
-
+ static int starttime = -1, msgid = 0;
+ if( starttime == -1 ){
+ srandom(starttime = (int)time(NULL));
+ msgid = random();
+ }
n = snprintf(buf, sizeof(buf),
"From: %s <%s>\r\n"
"To: %s\r\n"
@@ -93,8 +82,11 @@ void doSendBody(int sock, FILE *fp, char *from, char *to, char *subject) {
"Mime-Version: 1.0\r\n"
"Content-Type: text/plain; charset=\"big5\"\r\n"
"Content-Transfer-Encoding: 8bit\r\n"
+ "Message-Id: <%d.%x.outmail@ptt2.cc>\r\n"
"X-Disclaimer: [" BBSNAME "]對本信內容恕不負責\r\n\r\n",
- from, from, to, subject);
+ from, from, to, subject, starttime,
+ (msgid += (int)(random() >> 24)));
+ printf("%x\n", msgid);
write(sock, buf, n);
while(fgets(buf, sizeof(buf), fp)) {