Solved

MIME source code or libraries

Posted on 1999-01-06
8
212 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
  • 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
 

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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

747 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now