On Sun, 8 Feb 2009, Bart Mortelmans wrote:
> Hi,
>
> When using XMail 1.26-Pre05 with "redirect" in the mailproc.tab to forward
> mails, the header lines that where in the e-mail before delivery at
> XMailserver, seem to be prepended with something that very much looks like a
> white space. At least that's what it looks like when delivered to an Exim
> mailserver.
> Mails redirected to a hotmail address are interpreted incorrectly by hotmail.
> Hotmail shows parts of the headers of such an e-mail in the body.
>
> The problem occurs with mails delivered by XMail 1.26-Pre05 to an Exim or
> hotmail mailserver (maybe also to other MTA's?)
> The problem doesn't occur with mails delivered by XMail 1.26-Pre05 to an older
> version of XMail, to GMail, to QMail or to mails stored in the mailbox
> The problem also doesn't occur with mails delivered by XMail 1.24 with the
> exact same configuration
>
> The mails didn't pass by any filters or other plug-ins.
>
> Could this have something to do with the change to the line endings, but I
> thought that only changed things when storing mails in the mailbox?
>
> Is anybody else seeing this? Has anyone used this version for delivery to
> Hotmail or to a server running Exim?
>
> Davide, do let me know if you need any more information to be able to
> investigate this.
Thank you Bart. I think I found the problem. Can you try the patch below
on top of 1.26-pre05?
$ cd XMAIL_SOURCE
$ patch -p1 < PATCH_FILE
$ make -f MAKEFILE
- Davide
diff --git a/SMAILUtils.cpp b/SMAILUtils.cpp
index f7f5dba..6deef5d 100644
--- a/SMAILUtils.cpp
+++ b/SMAILUtils.cpp
@@ -932,12 +932,13 @@ int USmlGetMsgFileSection(SPLF_HANDLE hFSpool,
FileSection &FSect)
return 0;
}
-int USmlWriteMailFile(SPLF_HANDLE hFSpool, FILE *pMsgFile)
+int USmlWriteMailFile(SPLF_HANDLE hFSpool, FILE *pMsgFile, bool bMBoxFile)
{
SpoolFileData *pSFD = (SpoolFileData *) hFSpool;
/* Dump message tags */
- if (USmlDumpHeaders(pMsgFile, pSFD->hTagList, SYS_EOL) < 0)
+ if (USmlDumpHeaders(pMsgFile, pSFD->hTagList,
+ bMBoxFile ? SYS_EOL: "\r\n") < 0)
return ErrGetErrorCode();
fputs(SYS_EOL, pMsgFile);
@@ -949,19 +950,26 @@ int USmlWriteMailFile(SPLF_HANDLE hFSpool, FILE *pMsgFile)
ErrSetErrorCode(ERR_FILE_OPEN, pSFD->szMessFilePath);
return ERR_FILE_OPEN;
}
+
+ bool bWantCRLF = !bMBoxFile;
+
#ifdef SYS_CRLF_EOL
- if (MscCopyFile(pMsgFile, pMessFile, pSFD->llMailDataOffset,
- (SYS_OFF_T) -1) < 0) {
- fclose(pMessFile);
- return ErrGetErrorCode();
- }
-#else
- Sys_fseek(pMessFile, pSFD->llMailDataOffset, SEEK_SET);
- if (MscDos2UnixFile(pMsgFile, pMessFile) < 0) {
- fclose(pMessFile);
- return ErrGetErrorCode();
- }
+ if (!bWantCRLF)
+ bWantCRLF = true;
#endif
+ if (bWantCRLF) {
+ if (MscCopyFile(pMsgFile, pMessFile, pSFD->llMailDataOffset,
+ (SYS_OFF_T) -1) < 0) {
+ fclose(pMessFile);
+ return ErrGetErrorCode();
+ }
+ } else {
+ Sys_fseek(pMessFile, pSFD->llMailDataOffset, SEEK_SET);
+ if (MscDos2UnixFile(pMsgFile, pMessFile) < 0) {
+ fclose(pMessFile);
+ return ErrGetErrorCode();
+ }
+ }
fclose(pMessFile);
return 0;
@@ -1120,7 +1128,7 @@ int USmlCreateMBFile(UserInfo *pUI, const char
*pszFileName, SPLF_HANDLE hFSpool
SysFree(pszReturnPath);
/* Write mail file */
- if (USmlWriteMailFile(hFSpool, pMBFile) < 0) {
+ if (USmlWriteMailFile(hFSpool, pMBFile, true) < 0) {
ErrorPush();
fclose(pMBFile);
SysRemove(pszFileName);
diff --git a/SMAILUtils.h b/SMAILUtils.h
index 74c0f77..3e1bf73 100644
--- a/SMAILUtils.h
+++ b/SMAILUtils.h
@@ -77,7 +77,7 @@ const char *USmlSendRcptTo(SPLF_HANDLE hFSpool);
SYS_OFF_T USmlMessageSize(SPLF_HANDLE hFSpool);
int USmlSyncChanges(SPLF_HANDLE hFSpool);
int USmlGetMsgFileSection(SPLF_HANDLE hFSpool, FileSection &FSect);
-int USmlWriteMailFile(SPLF_HANDLE hFSpool, FILE *pMsgFile);
+int USmlWriteMailFile(SPLF_HANDLE hFSpool, FILE *pMsgFile, bool bMBoxFile =
false);
char *USmlGetTag(SPLF_HANDLE hFSpool, const char *pszTagName, TAG_POSITION
&TagPosition);
int USmlAddTag(SPLF_HANDLE hFSpool, const char *pszTagName,
const char *pszTagData, int iUpdate = 0);
_______________________________________________
xmail mailing list
[email protected]
http://xmailserver.org/mailman/listinfo/xmail