If Text5.Text <> "" Then
Base64EncodeFile Text5.Text, RichTextBox1, Text1 End If ConnectToServer "dudley.majordomos.com", Winsock1 Private Sub Command1_Click() Command1.Enabled = False If Text5.Text <> "" Then Base64EncodeFile Text5.Text, RichTextBox1, Text1 End If ConnectToServer "dudley.majordomos.com", Winsock1 End Sub Private Sub Winsock1_Connect() mailSend Text2.Text, Text3.Text, Text4.Text, Text6, Winsock1, Text5.Text, Text1 Command1.Enabled = True End Sub 'in the Connect Event of your winsock control add this mailSend text2.text, text3.text, text4.text, Text6, _ Winsock1, Text5.Text, Text1 vb call would look like this: return = Base64Encode("the") return would be: dGjl Notes: You can only pass 3 letters as the arguement. In order to process a whole file for de livery use the function Base64EncodeFile() also included in this bas file. -------------------------------------- Base64EncodeFile(fileToEncode, tempRTB Control, outputTo) -------------------------------------- Usage: vb call would look like this: Base64EncodeFile "c:\temp\test.zip", richtextb can send an attachment. It will send a MIME 1.0 compliant e-mail which is readbable by 90% of the professional e-mail software out there. The files are encoded in BASE64 which is the best choice For attachments (nothing obsolete like binhax / uuencode) Assumes:See body code for a sample project copy the api part up above to a module this is a sample project For this bas file. - first one (1) a winsock control and name it whatever you want - add one (1) richtextbox control and set it's visible option to False - add one (1) textbox With visible set to False and multiline set to True - add four (4) regular textbox' all set visible True * note: you can name them whatever, just remember the following settings For them: one will be the from field, one will be the to field, one will be the subject field and the last one will be the attachment field(you Type the full path in to the file, up to you to create the file open dialog boxes For this...) - add one (1) textbox set to visible = True and multiline = true i suggest making the scrollbars be horizontal. this box is intended For the actual message of the mail - add one (1) button which is the send button in the Click Event of your button add the following line: If Text5.Text <> "" Then Base64EncodeFile Text5.Text, RichTextBox1, Text1 End If ConnectToServer "dudley.majordomos.com", Winsock1 * note: text5.text in this example was the textbox used to Get the FULL path to the file to attach, richtextbox1 is self explanatory and text1.text was the box we set multiline and invisible * note: this is just an example server and the name of the winsock control can be whatever you named it in the Connect Event of your winsock control add this mailSend text2.text, text3.text, text4.text, Text6, _ Winsock1, Text5.Text, Text1 * note: here is an explanation of the params text2.text was the FROM field (who is sending it) text3.text was the TO field (who it is going to) text4.text was the SUBJECT field (duh) text6.text was the big textbox For the BODY winsock1 is the name of the winsock control text5.text is the filename of the attachment text1 is the name of the hidden textbox control you can leave the last two params off since those are optional and only needed If you want to attach a file last suggestion... when you click the button disable it and Then reenable it after the mailSend procedure: ----------------------------------------------------- For a sample project written in vb6, you can download it from: http://www.dellete.com/sendmail.zip |