Use this forum if you want to discuss a problem or ask a question related to a hMailServer beta release.
-
ssevennm
- New user

- Posts: 27
- Joined: 2005-06-21 01:15
Post
by ssevennm » 2005-06-24 21:53
Martin,
Doing a FETCH of the BODYSTRUCTURE is
NOT returning the Content-ID. It's also not returning the correct Content-Disposition. An example of an alternative text/plain, text/html message with one inline image that is used as an <img src="cid:my_image"> follows:
Code: Select all
BODYSTRUCTURE
(
(
(
"TEXT" "PLAIN"
("CHARSET" "US-ASCII")
NIL
NIL
"8bit"
912
33
)
(
"TEXT" "HTML"
("CHARSET" "US-ASCII")
NIL
NIL
"8bit"
2304
85
)
"ALTERNATIVE"
("BOUNDARY" "b2_00160b99fab657ababc820f52998b751")
NIL
NIL
)
(
"APPLICATION" "OCTET-STREAM"
("NAME" "logo.jpg")
NIL <<< ** this should be "<my_image>" **
NIL
"base64"
5696
NIL
("ATTACHMENT" ("FILENAME" "logo.jpg")) <<< ** this should be "INLINE" **
)
"RELATED"
("BOUNDARY" "b1_00160b99fab657ababc820f52998b751")
NIL
NIL
)
SquirrelMail is unable to find the image by cid if the Content-ID is not returned in the BODYSTRUCTURE for HTML mail. I will post the raw message of this sample less base64 block below. If I can help you with this problem, please let me know.
Last edited by
ssevennm on 2005-06-24 22:01, edited 1 time in total.
-
ssevennm
- New user

- Posts: 27
- Joined: 2005-06-21 01:15
Post
by ssevennm » 2005-06-24 22:00
Code: Select all
RFC822 Message body
Received: FROM [192.168.0.2] BY foo.bar.com with hMailServer ; Fri, 24 Jun 2005 12:23:24 -0600
Received: from localhost ([192.168.0.245]) by foo.bar.com with Microsoft SMTPSVC(6.0.3790.211);
Fri, 24 Jun 2005 12:23:22 -0600
Date: Fri, 24 Jun 2005 12:23:21 -0600
Return-Path: mailer@foo.com
To: Foo Bar <foo@bar.com>
From: Someone <foo2@bar.com>
Subject: Test Message
Message-ID: <fb853b08fa1f1a9c355fd4498e5f2374@localhost>
X-Priority: 3
X-Mailer: PHPMailer [version 1.72]
MIME-Version: 1.0
Content-Type: multipart/related;
type="text/html";
boundary="b1_fb853b08fa1f1a9c355fd4498e5f2374"
X-OriginalArrivalTime: 24 Jun 2005 18:23:23.0120 (UTC) FILETIME=[CE256F00:01C578E9]
--b1_fb853b08fa1f1a9c355fd4498e5f2374
Content-Type: multipart/alternative;
boundary="b2_fb853b08fa1f1a9c355fd4498e5f2374"
--b2_fb853b08fa1f1a9c355fd4498e5f2374
Content-Type: text/plain; charset = "iso-8859-1"
Content-Transfer-Encoding: 8bit
This is the plain text version.
--b2_fb853b08fa1f1a9c355fd4498e5f2374
Content-Type: text/html; charset = "iso-8859-1"
Content-Transfer-Encoding: 8bit
<img src="cid:my_image">
<p>This is the <b>HTML</b> version.</p>
--b2_fb853b08fa1f1a9c355fd4498e5f2374--
--b1_fb853b08fa1f1a9c355fd4498e5f2374
Content-Type: application/octet-stream; name="logo.jpg"
Content-Transfer-Encoding: base64
Content-ID: <my_image>
Content-Disposition: inline; filename="logo.jpg"
<<base64 block removed for posting>>
--b1_fb853b08fa1f1a9c355fd4498e5f2374--
-
ssevennm
- New user

- Posts: 27
- Joined: 2005-06-21 01:15
Post
by ssevennm » 2005-06-24 23:11
Well, as you probably already know, the code that's doing this is in IMAPFetch::_GetPartStructure(). Not having a windows development enviornment at my disposal, I hesitate to suggest a fix, though it looks like a NIL is hardcoded and a Content-ID isn't being written. Any change you could look at this?
Code: Select all
sResult += "(";
sResult += "\"" + sMainType + "\"";
sResult += " \"" + sSubType + "\"";
sResult += " " + sBodyParams ;
sResult += " NIL"; // Content-ID ???
if (sSubject.IsEmpty())
sResult += " NIL";
else
sResult += " \"" + sSubject + "\"";
if (sEncoding.IsEmpty())
sResult += " NIL";
else
sResult += " \"" + sEncoding + "\"";
sResult += " " + sSize;
Thanks.
-
martin
- Developer

- Posts: 6837
- Joined: 2003-11-21 01:09
- Location: Sweden
-
Contact:
Post
by martin » 2005-06-26 21:34
I think I have fixed this now, but I'm not entirely sure. The bodystructure part of the RFC is probably the most confusing part and it looks like I've misunderstood several parts of it. :-\
I would appreciate if you could forward the email to
martin@hmailserver.com so that I can test with the "correct" data. :-\
-
ssevennm
- New user

- Posts: 27
- Joined: 2005-06-21 01:15
Post
by ssevennm » 2005-06-27 03:33
I read it too. It is pretty ugly.
I'll send you the file right away.
Thanks.
-
martin
- Developer

- Posts: 6837
- Joined: 2003-11-21 01:09
- Location: Sweden
-
Contact:
Post
by martin » 2005-06-27 20:42
In your email to me, you write:
Here's what I think we SHOULD get:
Code: Select all
BODYSTRUCTURE ((("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "8bit"
153 7)("TEXT" "HTML" ("CHARSET" "US-ASCII") NIL NIL "8bit" 220 12)
"ALTERNATIVE" ("BOUNDARY" "b2_fb853b08fa1f1a9c355fd4498e5f2374") NIL
NIL)("APPLICATION" "OCTET-STREAM" ("NAME" "logo.jpg") "<logo.jpg>"
NIL "base64" 5696 NIL ("INLINE" ("FILENAME" "logo.jpg")))
"RELATED" ("BOUNDARY" "b1_fb853b08fa1f1a9c355fd4498e5f2374") NIL NIL)
In the example file you attached, the content-id was <logo_cid>. So I assume that in your bodystructure above, it should be "<logo_cid>" and not "<logo.jpg>", right?
I've modified the source so that the output is
Code: Select all
BODYSTRUCTURE ((("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "8bit" 153 7)("TEXT" "HTML" ("CHARSET" "US-ASCII") NIL NIL "8bit" 220 12) "ALTERNATIVE" ("BOUNDARY" "b2_fb853b08fa1f1a9c355fd4498e5f2374") NIL NIL)("APPLICATION" "OCTET-STREAM" ("NAME" "logo.jpg") "<logo_cid>" NIL "base64" 5696 NIL ("inline" ("FILENAME" "logo.jpg"))) "RELATED" ("BOUNDARY" "b1_fb853b08fa1f1a9c355fd4498e5f2374") NIL NIL))
Both the Content-ID and the Content-Disposition is now read from the MIME-part instead of being hardcoded... I've tested it with SquirrelMail 1.4.4, 1.5.0 and 1.5.1 and it works fine in those versions.
http://dev.hmailserver.com/hMailServer- ... ld-118.exe
Huge thanks for pointing out this error. This is probably the highest-quality bug report so far.

-
ssevennm
- New user

- Posts: 27
- Joined: 2005-06-21 01:15
Post
by ssevennm » 2005-06-27 20:49
You're absolutely correct. I did mean <logo_cid> and not <logo.jpg>. That would have been horrible if I had you fix the bug incorrectly.
I try to make it as painless as possible to fix the bugs, so you might be tempted to just go and fix them right away. And so far, you haven't let us down.
Thank for the quick turn around. I'll test it right away and let you know of the results.
-
FAWTS
- Normal user

- Posts: 74
- Joined: 2005-06-18 15:25
- Location: Paris
-
Contact:
Post
by FAWTS » 2005-06-27 23:16
It works perfectly, congratulation all of you!!!!!! And thank you very much!!!
Apache 1.3.33 PHP Version 4.4 hMailServer 4.1-B136 OS : Win XP SP2 AV : ClamAV 0.86.1
-
ssevennm
- New user

- Posts: 27
- Joined: 2005-06-21 01:15
Post
by ssevennm » 2005-06-28 00:01
I have also confirmed that the BODYSTRUCTURE is including the Content-ID and that images in HTML mail images referenced by cid are showing.
Good job, Martin.
I think I might have to
make a donation now.

-
martin
- Developer

- Posts: 6837
- Joined: 2003-11-21 01:09
- Location: Sweden
-
Contact:
Post
by martin » 2005-06-28 22:12
> I think I might have to make a donation now.
So I create the bugs, you find them I fix them, you donate. Sounds like a good deal to me.
Reporting stuff like this is donation enough .. but of course I don't mind a couple of $ as well.

-
ssevennm
- New user

- Posts: 27
- Joined: 2005-06-21 01:15
Post
by ssevennm » 2005-06-28 22:18
I like (and appreciate) the timeliness of your fixes, that's all.
-
martin
- Developer

- Posts: 6837
- Joined: 2003-11-21 01:09
- Location: Sweden
-
Contact:
Post
by martin » 2005-06-28 22:54
May I ask what you are using the server for?
-
ssevennm
- New user

- Posts: 27
- Joined: 2005-06-21 01:15
Post
by ssevennm » 2005-06-28 22:56
You may, I'll PM you details.