Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Different boundary in email header and body

Posted on 2012-04-09
5
824 Views
Last Modified: 2012-05-01
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=\"----=_NextPart_000_0023_01CD164E.F0EDAA20\"\r\n"

and in body is:
"\tboundary=\"----=_NextPart_001_0024_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
0
Comment
Question by:ziorinfo
  • 2
  • 2
5 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37825760
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.
0
 

Author Comment

by:ziorinfo
ID: 37831992
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
0
 
LVL 33

Expert Comment

by:Dave Howe
ID: 37832191
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
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37833762
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.
0
 
LVL 33

Accepted Solution

by:
Dave Howe earned 450 total points
ID: 37836766
Email is pretty complex, once you start dealing with inline images and the like. This is so complex because it has three phases
1) an attachment
2) an inline graphic
3) alternate text and html bodies.

if you start quoting emails,  you can get as many as 15 or 20 layers of boundary markers. you might be (unless you need search capability) better served to store the entire mail as a blob, headers, attachments and all.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Find out what Office 365 Transport Rules are, how they work and their limitations managing Office 365 signatures.
When you’re making plans to join the modern business race, you should analyze various details that may affect your results. Nowadays, millions of businesses are trying to grow into established and appreciated professional enterprises.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question