Fixes for Outlook emails

This commit is contained in:
Michiel Broek 2004-08-18 19:46:30 +00:00
parent 2921392683
commit ff1b44f0e4
4 changed files with 113 additions and 93 deletions

View File

@ -22,6 +22,9 @@ v0.61.4 11-Aug-2004
Can now send (hopefully) valid uplink requests to BBBS systems. Can now send (hopefully) valid uplink requests to BBBS systems.
Removed some debug logging from un_attach, made one into a Removed some debug logging from un_attach, made one into a
normal logmessage. normal logmessage.
The postemail and scanemail functions are changed so that
Outlook email addresses are parsed so that we can reply via
smtp.
mbindex: mbindex:
Fixed compiling pointlists where on the Boss line there is no Fixed compiling pointlists where on the Boss line there is no

View File

@ -56,10 +56,10 @@ extern int email_bad; /* Bad netmails */
*/ */
int postemail(FILE *fp, char *MailFrom, char *MailTo) int postemail(FILE *fp, char *MailFrom, char *MailTo)
{ {
char *temp, *p; char *temp, *p, buf[4096];
char buf[4096];
int result = 1; int result = 1;
faddr *fa; faddr *fa;
parsedaddr rfcaddr;
rewind(fp); rewind(fp);
Syslog('+', "SMTP: posting email from \"%s\" to \"%s\"", MailFrom, MailTo); Syslog('+', "SMTP: posting email from \"%s\" to \"%s\"", MailFrom, MailTo);
@ -88,21 +88,28 @@ int postemail(FILE *fp, char *MailFrom, char *MailTo)
} }
temp = calloc(MAX_LINE_LENGTH +1, sizeof(char)); temp = calloc(MAX_LINE_LENGTH +1, sizeof(char));
sprintf(temp, "MAIL FROM:<%s>\r\n", MailFrom);
if (smtp_cmd(temp, 250)) {
WriteError("SMTP: refused FROM <%s>", MailFrom);
email_bad++;
free(temp);
return 2;
}
sprintf(temp, "RCPT TO:<%s>\r\n", MailTo); rfcaddr = parserfcaddr(MailFrom);
sprintf(temp, "MAIL FROM:<%s@%s>\r\n", MBSE_SS(rfcaddr.remainder), MBSE_SS(rfcaddr.target));
Syslog('m', "%s", printable(temp, 0));
if (smtp_cmd(temp, 250)) { if (smtp_cmd(temp, 250)) {
WriteError("SMTP: refused TO <%s>", MailTo); WriteError("SMTP: refused FROM <%s@%s>", MBSE_SS(rfcaddr.remainder), MBSE_SS(rfcaddr.target));
email_bad++; email_bad++;
free(temp); free(temp);
return 2; return 2;
} }
tidyrfcaddr(rfcaddr);
rfcaddr = parserfcaddr(MailTo);
sprintf(temp, "RCPT TO:<%s@%s>\r\n", MBSE_SS(rfcaddr.remainder), MBSE_SS(rfcaddr.target));
Syslog('m', "%s", printable(temp, 0));
if (smtp_cmd(temp, 250)) {
WriteError("SMTP: refused TO <%s@%s>", MBSE_SS(rfcaddr.remainder), MBSE_SS(rfcaddr.target));
email_bad++;
free(temp);
return 2;
}
tidyrfcaddr(rfcaddr);
if (smtp_cmd((char *)"DATA\r\n", 354)) { if (smtp_cmd((char *)"DATA\r\n", 354)) {
WriteError("SMTP refused DATA mode"); WriteError("SMTP refused DATA mode");

View File

@ -1085,7 +1085,7 @@ void ExportNet(unsigned long MsgNum, int UUCPgate)
*/ */
void ExportEmail(unsigned long MsgNum) void ExportEmail(unsigned long MsgNum)
{ {
char *p; char *p, *q, MailFrom[128], MailTo[128];
FILE *qp; FILE *qp;
int retval, flags = 0, kludges = TRUE; int retval, flags = 0, kludges = TRUE;
faddr *from, *too; faddr *from, *too;
@ -1146,26 +1146,35 @@ void ExportEmail(unsigned long MsgNum)
if (CFG.EmailMode != E_NOISP) { if (CFG.EmailMode != E_NOISP) {
/* /*
* Dialup or direct internet connection, send message via MTA. * Dialup or direct internet connection, send message via MTA.
* First check if the From and To addresses contain spaces, if * Reformat the addresses for SMTP.
* so everything after the space is removed.
*/ */
p = Msg.From; p = Msg.From;
while (*p) { if ((strchr(p, '<') != NULL) && (strchr(p, '>') != NULL)) {
if (*p == ' ') { q = strtok(p, "<");
*p = '\0'; q = strtok(NULL, ">");
break; sprintf(MailFrom, "%s", q);
} } else if (Msg.From[0] == ' ') {
p++; q = strtok(p, " ");
q = strtok(NULL, " \n\r\t");
sprintf(MailFrom, "%s", q);
} else {
sprintf(MailFrom, "%s", Msg.From);
} }
p = Msg.To; p = Msg.To;
while (*p) { if ((strchr(p, '<') != NULL) && (strchr(p, '>') != NULL)) {
if (*p == ' ') { q = strtok(p, "<");
*p = '\0'; q = strtok(NULL, ">");
break; sprintf(MailTo, "%s", q);
} else if (Msg.To[0] == ' ') {
q = strtok(p, " ");
q = strtok(NULL, " \n\r\t");
sprintf(MailTo, "%s", q);
} else {
sprintf(MailTo, "%s", Msg.To);
} }
p++;
} retval = postemail(qp, MailFrom, MailTo);
retval = postemail(qp, Msg.From, Msg.To);
} else { } else {
/* /*
* Message goes to UUCP gateway. * Message goes to UUCP gateway.

View File

@ -2448,6 +2448,7 @@ void CheckMail()
* Only check the received status of the email. The mail * Only check the received status of the email. The mail
* may not be direct addressed to this user (aliases database) * may not be direct addressed to this user (aliases database)
* but if it is in his mailbox it is always for the user. * but if it is in his mailbox it is always for the user.
* FIXME: mail writte by the user is shown as new too.
*/ */
if (!Msg.Received) { if (!Msg.Received) {
/* /*