Login  
Search All Forums
Dart Home | PowerTCP Mail for ActiveX | Custom Development Reply | PowerTCP Mail for ActiveX Topics | Forums   
AuthorForum: PowerTCP Mail for ActiveX
Topic: uuencode
User127

From: Venray, Netherlands
Posts: 30
Member Since: 04/10/02
posted April 10, 2002 6:15 AM

How to send mail with Dart MAIL tool (SMTP) using uuencode instead of base64.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted April 10, 2002 1:18 PM


You'd have to encode the file into a string and add that string as text a message (make sure you turn quotedprintable off before adding to the message. Below are some VB functions that would create a UUENCODEd string from a file:

Public Function GetUUEncodeText(Filename As String) As String
  On Error GoTo OnError
  ' Create a DartStream and read the data into it
  ' (if you don't see DartStreams add the "Dart TCP, UDP and Daemon Controls"
  ' as a reference in your project
  Dim Stream As New DartStream
  Stream.FileMode = createExisting
  Stream.Filename = Filename
  
  ' Read the stream into a string
  Dim Source As String
  Stream.Read Source
  Set Stream = Nothing
  
  ' Create a message object and use the EncodeBuf method
  ' to UUENCODE the data
  Dim msg As New Message
  Dim Buffer As String
  msg.EncodeBuf Source, Buffer, msgUUEncode
  
  ' Add the "begin 644" line and return
  GetUUEncodeText = "begin 644 " + GetFilename(Filename) + vbCrLf + Buffer
  Exit Function
OnError:
  MsgBox "ERROR #" + CStr(Err.Number) + ": " + Err.Description
End Function

Public Function GetFilename(ByVal Path As String) As String
  Dim n As Long
  n = InStrRev(Path, "\")
  If n = 0 Then n = InStrRev(Path, "/")
  GetFilename = Mid(Path, n + 1)
End Function


Hope this helps!

Tony Priest
Dart Tech Support
Reply | PowerTCP Mail for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX