Solved

MIME source code or libraries

Posted on 1999-01-06
8
215 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
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 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