I recently discovered that when using the vbSendMail DLL to send multiple long filename attachments, the email message will not be sent because the DLL can not handle the long filenames.

As a workaround, you must convert long filenames to their equivalent short (DOS 8.3) filenames.


Module
======
(General)_(Declarations)
Private Declare Function GetShortPathName Lib "kernel32" _
Alias "GetShortPathNameA" _
ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, _
ByVal cchBuffer As Long) As Long

(General)_ShortFileName
Public Function ShortFileName(ByVal LongFileName As String) As String
Dim strBuffer As String * 255
Dim lngResult As Long

lngResult = GetShortPathName(LongFileName, strBuffer, Len(strBuffer))

ShortFileName = Left$(strBuffer, lngResult)
End Function

Form
====
(General)_(Declarations)
Private WithEvents poSendMail As vbSendMail.clsSendMail

Form_Load
Private Sub Form_Load()
Set poSendMail = New clsSendMail
End Sub

(General)_SendEmail
Private Sub SendEmail()
With poSendMail
.Delimiter = ";"
.Attachment = ShortFileName(txtAttachment1.txt) & .Delimiter & ShortFileName(txtAttachment2.txt)
DoEvents
.Connect
DoEvents
.Send
DoEvents
.Disconnect
End With
End Sub