Greetings all,
I have a problem that perhaps someone may be able to assist me on.
I am currently writing my own code to send SMTP mail using winsock
control. I am aware of samples of this code on the internet
from sites such as planetsourcecode.com, but because of the
readabilty and the functionality I have decided to write my own.
Writing this code will allow me to send email from a computer
that does not have a email client installed or configured.
I have gotten my code to send plain text messages so far, but
now I am having a little problem with the attachment portion of it.
Currently I am working on a routine in my VB program which
converts a binary stream to base64. I have read the appropriate
RFC's on the subject and have made quite a bit of progress, but
I have run into a snag that perhaps someone may be able to
help me out of.
Here is a little pseudocode on what have I done so far:
Take 24 bits (3 bytes) of information from a binary file
Force this 24 bits into a long type variable.
I use AND with the following hex masks to extract
the 4 6bit characters respectively:
lngChar(1) = (inValue And &HFC0000)
lngChar(1) = lngChar(1) / &H80000
lngChar(2) = (inValue And &H3F000)
lngChar(2) = lngChar(2) / &H1000
lngChar(3) = (inValue And &HFC0)
lngChar(3) = lngChar(3) / &H80
lngChar(4) = (inValue And &H3F)
Because of the lack of bitwise shift operators
I am forced to divide by a mask to shift the
information.
This code doesn't seem to be generating the correct
characters that I need. Is there something I'm just
overlooking?
Cardyin
-----------------------------------------
Cardyin Kim
Client/Server and Web Development Analyst
San Antonio Community Hospital
Upland, California
ckim@s... (xxx) xxx-xxxx
-----------------------------------------