Solved

MIME source code or libraries

Posted on 1999-01-06
8
213 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

920 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

15 Experts available now in Live!

Get 1:1 Help Now