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.
Added Q&A about failing internet polls.
mbsebbs:
Email posted at the bbs was not signed with the signature.
mbcico:
Fixed crash with incoming YooHoo session with bad password.
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
switch in mbsetup.
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:
Removed debug logging of "does" info.

View File

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

View File

@ -255,105 +255,116 @@ int Export_a_Email(unsigned long Num)
*/
int Save_Email(int IsReply)
{
int i;
char *p, *temp;
unsigned long crc = -1;
long id;
FILE *fp;
int i;
char *p, *temp;
unsigned long crc = -1;
long id;
FILE *fp;
if (Line < 2)
return TRUE;
if (Line < 2)
return TRUE;
if (!Open_Msgbase(sMailpath, 'w')) {
return FALSE;
if (!Open_Msgbase(sMailpath, 'w')) {
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;
Msg.Local = TRUE;
Msg.Netmail = TRUE;
temp = calloc(PATH_MAX, sizeof(char));
/*
* Save if to disk
*/
Msg_AddMsg();
Msg_UnLock();
/*
* 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);
// 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);
ReadExitinfo();
exitinfo.iPosted++;
WriteExitinfo();
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;
do_mailout = TRUE;
LC_Wrote = TRUE;
/*
* Add message text
*/
for (i = 1; i < Line; i++) {
MsgText_Add2(Message[i]);
}
MsgText_Add2(TearLine());
Syslog('+', "Email (%ld) to \"%s\", \"%s\", in mailbox", Msg.Id, Msg.To, Msg.Subject);
/*
* Save if to disk
*/
Msg_AddMsg();
Msg_UnLock();
colour(CFG.HiliteF, CFG.HiliteB);
/* Saving message to disk */
printf("\n%s(%ld)\n\n", (char *) Language(202), Msg.Id);
fflush(stdout);
sleep(2);
ReadExitinfo();
exitinfo.iPosted++;
WriteExitinfo();
/*
* 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);
}
do_mailout = TRUE;
LC_Wrote = TRUE;
free(temp);
Msg_Close();
Syslog('+', "Email (%ld) to \"%s\", \"%s\", in mailbox", Msg.Id, Msg.To, Msg.Subject);
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;
return TRUE;
}