Mahesh Yadav
asked on
Different boundary in email header and body
Hi,
We are working on reading emails and then store their data in database.
Our email read function working fine but we face problem when email contains different boundary in header and body. In that case the body content is not saved and garbage value is displayed in place of email body.
like in one sample email the boundry value in header is:
"\tboundary=\"----=_NextPa rt_000_002 3_01CD164E .F0EDAA20\ "\r\n"
and in body is:
"\tboundary=\"----=_NextPa rt_001_002 4_01CD164E .F0F01B20\ "\r\n"
Can you please suggest me to understand why email contains different boundaries and how we handle this problem.
Please find that sample email attached.
FW--font-7-5.msg
We are working on reading emails and then store their data in database.
Our email read function working fine but we face problem when email contains different boundary in header and body. In that case the body content is not saved and garbage value is displayed in place of email body.
like in one sample email the boundry value in header is:
"\tboundary=\"----=_NextPa
and in body is:
"\tboundary=\"----=_NextPa
Can you please suggest me to understand why email contains different boundaries and how we handle this problem.
Please find that sample email attached.
FW--font-7-5.msg
I don't know what that file is but it is Not an email message. Emails typically have more than one boundary because they have been forwarded and each email client that formats the message as an HTML email adds their own boundary codes.
ASKER
Hi DaveBaldwin,
Thanks for the answer, but can you plz tell me how do i handle this problem as the mail header contains one boundary and body is seperated by other boundary.
The attached file is a .msg file which can be opened in microsoft outlook.
Thanks
Heeralal
Thanks for the answer, but can you plz tell me how do i handle this problem as the mail header contains one boundary and body is seperated by other boundary.
The attached file is a .msg file which can be opened in microsoft outlook.
Thanks
Heeralal
It is pretty common for mails to contain more than one boundary - but in each case, there will be a boundary header that lets you know the grouping for which the boundary is the marker.
in your case, you have a nested structure which I have diagrammed in the attached file.
in text though, the "outer" layer contains the nest plus an attached file.
the "middle" layer contains a nest plus a gif image
the "inner" layer contains a text and a html body as alternatives.
MIME-Structure.txt
in your case, you have a nested structure which I have diagrammed in the attached file.
in text though, the "outer" layer contains the nest plus an attached file.
the "middle" layer contains a nest plus a gif image
the "inner" layer contains a text and a html body as alternatives.
MIME-Structure.txt
You could make your program more sophisticated and able to recognize multiple boundaries. But the problem is that it would be very difficult for your program to know what is important enough to be saved.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.