Solved

MIME source code or libraries

Posted on 1999-01-06
8
216 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

696 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