Solved

MIME source code or libraries

Posted on 1999-01-06
8
220 Views
Last Modified: 2013-12-03
I'm writing a custom email client, which works well, but I don't want to reinvent the wheel for extracting and embedding MIME file attachments.

Does anyone know of source code samples or third-party DLLs (free or cheap preferred) for doing this?
0
Comment
Question by:scce
[X]
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
  • 4
  • 3
8 Comments
 
LVL 1

Expert Comment

by:dnavarro
ID: 1418242
What language?  I think I have some C source for MIME encoding.
0
 

Author Comment

by:scce
ID: 1418243
C or C++ would be fine.
0
 
LVL 1

Accepted Solution

by:
dnavarro earned 50 total points
ID: 1418244
I clipped this from the BLAT source code:

// MIME base64 Content-Transfer-Encoding  -- Added in v1.6 by Tim Charron tcharron@interlog.com
#define B64_ENC(Ch) (char) (base64table[(char)(Ch) & 63])
void base64_encode(char *in, char *endin, char *out)
{
   char base64table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

   int length = endin - in ;

   char *b = out, *data = in;
   for ( ; length > 2; length -= 3, data += 3 ) {
      if ( ((data-in)%54) == 0 ) {*b++ = '\r'; *b++ = '\n';}
      *b++ = B64_ENC(data[0] >> 2);
      *b++ = B64_ENC(((data[0] << 4) & 060) | ((data[1] >> 4) & 017));
      *b++ = B64_ENC(((data[1] << 2) & 074) | ((data[2] >> 6) & 03));
      *b++ = B64_ENC(data[2] & 077);
   }

   if ( length == 1 ) {
      if ( ((data-in)%54) == 0 ) {*b++ = '\r'; *b++ = '\n';}
      *b++ = B64_ENC(data[0] >> 2);
      *b++ = B64_ENC((data[0] << 4) & 060);
      *b++ = '=';
      *b++ = '=';
   } else if ( length == 2 ) {
      if ( ((data-in)%54) == 0 ) {*b++ = '\r'; *b++ = '\n';}
      *b++ = B64_ENC(data[0] >> 2);
      *b++ = B64_ENC(((data[0] << 4) & 060) | ((data[1] >> 4) & 017));
      *b++ = B64_ENC((data[1] << 2) & 074);
      *b++ = '=';
   }
   *b = 0;

   return;
}

If you'd like, I can zip up the complete source and email it to you, just give me your email address.
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

Author Comment

by:scce
ID: 1418245
Thanks, my email address is

scce@chordwizard.com

I also need the logic for extracting the sub-parts of the message from the complete text.  Is that in the source you have?  Are you aware of any other sites may have this type of resource? - it's pretty specialised, I know.
0
 

Author Comment

by:scce
ID: 1418246
Hi dnavarro,

Did you send the complete source for the MIME encoding?  I haven't received it yet.  If it's on the internet somewhere you can just point me to it.  Whats the BLAT?

Thanks.  My email address is:

scce@chordwizard.com
0
 
LVL 1

Expert Comment

by:dnavarro
ID: 1418247
Sorry, missed your earlier comment.  I'm emailing you the entire BLAT package (with source) right now.
0
 

Author Comment

by:scce
ID: 1418248
Thanks very much.  It arrived safely.
0
 

Expert Comment

by:Sembiance
ID: 3395850
Just for anyone still wondering, BLAT can be found at:
http://gepasi.dbs.aber.ac.uk/softw/Blat.html
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

717 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