Groups | Blog | Home
all groups > iis smtp nntp > october 2004 >

iis smtp nntp : Problem with attachment in SMTP mail


h.migneron NO[at]SPAM gmail.com
10/26/2004 9:48:39 AM
Hello,
I am using a class in c#.net to send emails. The class works fine and
i have no problem sending emails without attachments. When i put an
attachment to the email, the message is sent/received and the
attachment seems to be in the message, since it is 400k big for an
empty body message (i try to put a 400k attachment) but i can't access
the attachment.
Here are the commands i send to the host :

HELO xxMyHostxx.com
MAIL FROM:<xxxx@xxxxxxx.com>
RCPT TO:<xxxx@xxxxxxx.com>
DATA
MIME-Version: 2.2
X-Mailer: smwEmailer.SmtpEmailer
FROM: xxxx@xxxxxxx.com
TO: xxxx@xxxxxxx.com
REPLY-TO: xxxx@xxxxxxx.com
DATE: Tue, 26 Oct 2004 16:23:19 GMT
SUBJECT: TEST
Content-Type: multipart/mixed; boundary="#SEPARATOR1#"
This is a multi-part message in MIME format.
--#SEPARATOR1#
Content-Type: application/octet-stream; name="a.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="a.txt"
Content-ID: <a>

--#SEPARATOR1#
Content-Type: multipart/alternative; boundary="#SEPARATOR2#"
--#SEPARATOR2#
Content-Type: text/plain; charset=iso-8859-1
Your email client does not support MHTML messages
--#SEPARATOR2#
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
This is the the body of the email
--#SEPARATOR2#--
--#SEPARATOR1#--
..
QUIT

All the adresses are working. The attachment is a simple text file...
If anyone can help me with that, it would be much appreciated

Bronek Kozicki
10/26/2004 11:19:41 PM
[quoted text, click to view]

message seems correct. What exactly means "I can't access the attachment"?


Hugo Migneron
10/27/2004 6:20:29 AM
Hi,
It means that, for example, it Outlook, there is no attachment in the
attachment section. I know it is in the message, since the message is
too big for an empty message (400k big message pour a empty message with
a 400k attachment) but i just don't see anything, juste like if there
were no attachment at all.
The problem is not the smtp server because I used the System.web.mail
namespace for testing and the attachments got to destination and i could
see them normally. I cannot use this namespace because my application
must be usable on other platforms...
Anyways, if you have any idea, let me know!

Thanks


*** Sent via Developersdex http://www.developersdex.com ***
Hugo Migneron
10/27/2004 6:30:22 AM




*** Sent via Developersdex http://www.developersdex.com ***
Bronek Kozicki
10/27/2004 8:24:47 PM
[quoted text, click to view]

Ok, now I see. There are two problems with the message. I think that
"MIME-Version: 2.2" is invalid, you should use version number 1.0
Another problem is lack of one empty line (jusy \r\n characters) after
message headers. You should also have one empty line below each MIME
header. See below for working example.


B.



MIME-Version: 1.0
X-Mailer: smwEmailer.SmtpEmailer
FROM: xxxx@xxxxxxx.com
TO: xxxx@xxxxxxx.com
REPLY-TO: xxxx@xxxxxxx.com
DATE: Tue, 26 Oct 2004 16:23:19 GMT
SUBJECT: TEST
Content-Type: multipart/mixed; boundary="#SEPARATOR1#"

This is a multi-part message in MIME format.

--#SEPARATOR1#
Content-Type: application/octet-stream; name="a.txt"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="a.txt"
Content-ID: <a>

bla bla bla

--#SEPARATOR1#
Content-Type: multipart/alternative; boundary="#SEPARATOR2#"

--#SEPARATOR2#
Content-Type: text/plain; charset=iso-8859-1

Your email client does not support MHTML messages

--#SEPARATOR2#
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

<html><body><h2>This is the the body of the email</h2></body></html>

--#SEPARATOR2#--
Hugo Migneron
10/28/2004 7:50:34 AM
Hello,
Thank you for your reply
Unfortunatly, it still doesn't work with the changes you sugested. I
changed the version number and added the blank lines, but i still have
the same problem (attachments not visible)

If you have any other idea, please let me know!

Thanks

Hugo M


*** Sent via Developersdex http://www.developersdex.com ***
Hugo Migneron
10/29/2004 11:40:32 AM
Hi there,
Thanks for your help. I found the solution to the problem this
morning... I removed the "Content-ID" line in the attachment section and
replaced it with a blank line "\r\n" and everything works fine now.
I don't really understand why it works now, but...

Thank you for your help!

Hugo


*** Sent via Developersdex http://www.developersdex.com ***
Bronek Kozicki
10/29/2004 8:12:32 PM
[quoted text, click to view]

please send one such message to my address. I will take a look.


AddThis Social Bookmark Button