Fixed posting local email to SMTP server

This commit is contained in:
Michiel Broek 2002-11-02 14:51:19 +00:00
parent bab69f2208
commit 5667926eab
3 changed files with 186 additions and 153 deletions

View File

@ -19,6 +19,9 @@ v0.35.05 19-Oct-2002
Changed the section about ftp feeds. Changed the section about ftp feeds.
Added Q&A about failing internet polls. Added Q&A about failing internet polls.
mbsebbs:
Email posted at the bbs was not signed with the signature.
mbcico: mbcico:
Fixed crash with incoming YooHoo session with bad password. Fixed crash with incoming YooHoo session with bad password.
Still used the phone override fields for hostname override Still used the phone override fields for hostname override
@ -54,6 +57,8 @@ v0.35.05 19-Oct-2002
Echomail is now also packed or not according to the packmail Echomail is now also packed or not according to the packmail
switch in mbsetup. switch in mbsetup.
Statistics count for exported echomail now works. Statistics count for exported echomail now works.
Email posted in the email box in full domain mode was refused
by SMTP servers because of bad address formatting.
mbtask: mbtask:
Removed debug logging of "does" info. Removed debug logging of "does" info.

View File

@ -1109,81 +1109,98 @@ void ExportNet(unsigned long MsgNum, int UUCPgate)
*/ */
void ExportEmail(unsigned long MsgNum) void ExportEmail(unsigned long MsgNum)
{ {
char *p; char *p;
FILE *qp; FILE *qp;
int retval, flags = 0; int retval, flags = 0, kludges = TRUE;
faddr *from, *too; faddr *from, *too;
int kludges = TRUE;
Syslog('m', "Export email to %s", Msg.To); Syslog('m', "Export email to %s", Msg.To);
Syslog('m', " from %s", Msg.From); Syslog('m', " from %s", Msg.From);
Msg.Sent = TRUE; Msg.Sent = TRUE;
if (Msg.KillSent) if (Msg.KillSent)
Msg.Deleted = TRUE; Msg.Deleted = TRUE;
/* /*
* For local scanned messages both addresses are the same. * For local scanned messages both addresses are the same.
*/ */
from = fido2faddr(CFG.EmailFidoAka); from = fido2faddr(CFG.EmailFidoAka);
too = fido2faddr(CFG.EmailFidoAka); too = fido2faddr(CFG.EmailFidoAka);
qp = tmpfile(); qp = tmpfile();
flags |= (Msg.Private) ? M_PVT : 0; flags |= (Msg.Private) ? M_PVT : 0;
flags |= (Msg.Crash) ? M_CRASH : 0; flags |= (Msg.Crash) ? M_CRASH : 0;
flags |= (Msg.Hold) ? M_HOLD : 0; flags |= (Msg.Hold) ? M_HOLD : 0;
flags |= (Msg.Immediate) ? M_CRASH : 0; flags |= (Msg.Immediate) ? M_CRASH : 0;
flags |= (Msg.FileRequest) ? M_REQ : 0; flags |= (Msg.FileRequest) ? M_REQ : 0;
flags |= (Msg.FileAttach) ? M_FILE : 0; flags |= (Msg.FileAttach) ? M_FILE : 0;
flags |= (Msg.ReceiptRequest) ? M_RRQ : 0; flags |= (Msg.ReceiptRequest) ? M_RRQ : 0;
flags |= (Msg.ConfirmRequest) ? M_AUDIT : 0; flags |= (Msg.ConfirmRequest) ? M_AUDIT : 0;
Syslog('m', "------------ Scanned message start"); Syslog('m', "------------ Scanned message start");
if (Msg_Read(MsgNum, 78)) { if (Msg_Read(MsgNum, 78)) {
if ((p = (char *)MsgText_First()) != NULL) { if ((p = (char *)MsgText_First()) != NULL) {
do { do {
Syslog('m', "%s", printable(p, 0)); Syslog('m', "%s", printable(p, 0));
/* /*
* GoldED places ^A characters in front of the RFC headers, * GoldED places ^A characters in front of the RFC headers,
* so does mbsebbs as well. * so does mbsebbs as well.
*/ */
if (p[0] == '\001') { if (p[0] == '\001') {
fprintf(qp, "%s\n", p+1); fprintf(qp, "%s\n", p+1);
if (!strncmp(p, "\001PID:", 5)) { if (!strncmp(p, "\001PID:", 5)) {
fprintf(qp, "TID: MBSE-FIDO %s\n", VERSION); fprintf(qp, "TID: MBSE-FIDO %s\n", VERSION);
} }
} else { } else {
if (kludges) { if (kludges) {
kludges = FALSE; kludges = FALSE;
fprintf(qp, "\n"); fprintf(qp, "\n");
} }
fprintf(qp, "%s\n", p); fprintf(qp, "%s\n", p);
}
} while ((p = (char *)MsgText_Next()) != NULL);
} }
} while ((p = (char *)MsgText_Next()) != NULL);
} }
Syslog('m', "------------ Scanned message end"); }
rewind(qp); Syslog('m', "------------ Scanned message end");
most_debug = TRUE; rewind(qp);
most_debug = TRUE;
/*
* At this point the message is RFC formatted.
*/
if (CFG.EmailMode != E_NOISP) {
/* /*
* At this point the message is RFC formatted. * Dialup or direct internet connection, send message via MTA.
* First check if the From and To addresses contain spaces, if
* so everything after the space is removed.
*/ */
if (CFG.EmailMode != E_NOISP) { p = Msg.From;
/* while (*p) {
* Dialup or direct internet connection, send message via MTA. if (*p == ' ') {
*/ *p = '\0';
retval = postemail(qp, Msg.From, Msg.To); break;
} else { }
/* p++;
* Message goes to UUCP gateway.
*/
retval = rfc2ftn(qp, too);
} }
p = Msg.To;
while (*p) {
if (*p == ' ') {
*p = '\0';
break;
}
p++;
}
retval = postemail(qp, Msg.From, Msg.To);
} else {
/*
* Message goes to UUCP gateway.
*/
retval = rfc2ftn(qp, too);
}
most_debug = FALSE; most_debug = FALSE;
tidy_faddr(from); tidy_faddr(from);
tidy_faddr(too); tidy_faddr(too);
Syslog('m', "posted email rc=%d", retval); Syslog('m', "posted email rc=%d", retval);
email_out++; email_out++;
} }

View File

@ -255,105 +255,116 @@ int Export_a_Email(unsigned long Num)
*/ */
int Save_Email(int IsReply) int Save_Email(int IsReply)
{ {
int i; int i;
char *p, *temp; char *p, *temp;
unsigned long crc = -1; unsigned long crc = -1;
long id; long id;
FILE *fp; FILE *fp;
if (Line < 2) if (Line < 2)
return TRUE; return TRUE;
if (!Open_Msgbase(sMailpath, 'w')) { if (!Open_Msgbase(sMailpath, 'w')) {
return FALSE; return FALSE;
}
Msg.Arrived = time(NULL) - (gmt_offset((time_t)0) * 60);
Msg.Written = Msg.Arrived;
Msg.Local = TRUE;
Msg.Netmail = TRUE;
temp = calloc(PATH_MAX, sizeof(char));
/*
* Add header lines
*/
sprintf(temp, "\001Date: %s", rfcdate(Msg.Written));
MsgText_Add2(temp);
sprintf(temp, "\001From: %s", Msg.From);
MsgText_Add2(temp);
sprintf(temp, "\001Subject: %s", Msg.Subject);
MsgText_Add2(temp);
sprintf(temp, "\001Sender: %s", Msg.From);
MsgText_Add2(temp);
sprintf(temp, "\001To: %s", Msg.To);
MsgText_Add2(temp);
MsgText_Add2((char *)"\001MIME-Version: 1.0");
MsgText_Add2((char *)"\001Content-Type: text/plain");
MsgText_Add2((char *)"\001Content-Transfer-Encoding: 8bit");
sprintf(temp, "\001X-Mailreader: MBSE BBS %s", VERSION);
MsgText_Add2(temp);
p = calloc(81, sizeof(char));
id = sequencer();
sprintf(p, "<%08lx@%s>", id, CFG.sysdomain);
sprintf(temp, "\001Message-id: %s", p);
MsgText_Add2(temp);
Msg.MsgIdCRC = upd_crc32(temp, crc, strlen(temp));
free(p);
if (IsReply) {
sprintf(temp, "\001In-reply-to: %s", Msg.Replyid);
MsgText_Add2(temp);
crc = -1;
Msg.ReplyCRC = upd_crc32(temp, crc, strlen(temp));
} else
Msg.ReplyCRC = 0xffffffff;
/*
* Add message text
*/
for (i = 1; i < Line; i++) {
MsgText_Add2(Message[i]);
}
/*
* Add signature.
*/
sprintf(temp, "%s/%s/.signature", CFG.bbs_usersdir, exitinfo.Name);
if ((fp = fopen(temp, "r"))) {
Syslog('m', " Add .signature");
MsgText_Add2((char *)"");
while (fgets(temp, 80, fp)) {
Striplf(temp);
MsgText_Add2(temp);
} }
fclose(fp);
MsgText_Add2((char *)"");
}
MsgText_Add2(TearLine());
Msg.Arrived = time(NULL) - (gmt_offset((time_t)0) * 60); /*
Msg.Written = Msg.Arrived; * Save if to disk
Msg.Local = TRUE; */
Msg.Netmail = TRUE; Msg_AddMsg();
temp = calloc(PATH_MAX, sizeof(char)); Msg_UnLock();
/* ReadExitinfo();
* Add header lines exitinfo.iPosted++;
*/ WriteExitinfo();
sprintf(temp, "\001Date: %s", rfcdate(Msg.Written));
MsgText_Add2(temp);
sprintf(temp, "\001From: %s", Msg.From);
MsgText_Add2(temp);
sprintf(temp, "\001Subject: %s", Msg.Subject);
MsgText_Add2(temp);
sprintf(temp, "\001Sender: %s", Msg.From);
MsgText_Add2(temp);
sprintf(temp, "\001To: %s", Msg.To);
MsgText_Add2(temp);
MsgText_Add2((char *)"\001MIME-Version: 1.0");
MsgText_Add2((char *)"\001Content-Type: text/plain");
MsgText_Add2((char *)"\001Content-Transfer-Encoding: 8bit");
sprintf(temp, "\001X-Mailreader: MBSE BBS %s", VERSION);
MsgText_Add2(temp);
p = calloc(81, sizeof(char));
id = sequencer();
sprintf(p, "<%08lx@%s>", id, CFG.sysdomain);
sprintf(temp, "\001Message-id: %s", p);
MsgText_Add2(temp);
// sprintf(temp, "\001MSGID: %s %08lx", aka2str(CFG.EmailFidoAka), id);
// MsgText_Add2(temp);
Msg.MsgIdCRC = upd_crc32(temp, crc, strlen(temp));
free(p);
// sprintf(temp, "\001PID: MBSE-BBS %s", VERSION);
// MsgText_Add2(temp);
if (IsReply) { do_mailout = TRUE;
sprintf(temp, "\001In-reply-to: %s", Msg.Replyid); LC_Wrote = TRUE;
MsgText_Add2(temp);
crc = -1;
Msg.ReplyCRC = upd_crc32(temp, crc, strlen(temp));
} else
Msg.ReplyCRC = 0xffffffff;
/* Syslog('+', "Email (%ld) to \"%s\", \"%s\", in mailbox", Msg.Id, Msg.To, Msg.Subject);
* Add message text
*/
for (i = 1; i < Line; i++) {
MsgText_Add2(Message[i]);
}
MsgText_Add2(TearLine());
/* colour(CFG.HiliteF, CFG.HiliteB);
* Save if to disk /* Saving message to disk */
*/ printf("\n%s(%ld)\n\n", (char *) Language(202), Msg.Id);
Msg_AddMsg(); fflush(stdout);
Msg_UnLock(); sleep(2);
ReadExitinfo(); /*
exitinfo.iPosted++; * Add quick mailscan info
WriteExitinfo(); */
sprintf(temp, "%s/tmp/netmail.jam", getenv("MBSE_ROOT"));
if ((fp = fopen(temp, "a")) != NULL) {
fprintf(fp, "%s/%s/mailbox %lu\n", CFG.bbs_usersdir, exitinfo.Name, Msg.Id);
fclose(fp);
}
do_mailout = TRUE; free(temp);
LC_Wrote = TRUE; Msg_Close();
Syslog('+', "Email (%ld) to \"%s\", \"%s\", in mailbox", Msg.Id, Msg.To, Msg.Subject); return TRUE;
colour(CFG.HiliteF, CFG.HiliteB);
/* Saving message to disk */
printf("\n%s(%ld)\n\n", (char *) Language(202), Msg.Id);
fflush(stdout);
sleep(2);
/*
* Add quick mailscan info
*/
sprintf(temp, "%s/tmp/netmail.jam", getenv("MBSE_ROOT"));
if ((fp = fopen(temp, "a")) != NULL) {
fprintf(fp, "%s/%s/mailbox %lu\n", CFG.bbs_usersdir, exitinfo.Name, Msg.Id);
fclose(fp);
}
free(temp);
Msg_Close();
return TRUE;
} }