Hello,

I have installed vbSendMail.dll and mswinsck.ocx and registered them using REGSVR32.

I am calling vbSendMail from MS Access 2007 VBA code. The code correctly generates an email if I do not specify an attachment. However, when I specify an attachment, error 429 is encountered.

I have tried unregistering and reregistering vbSendMail.dll and mswinsck.ocx but that did not help.

I tried using GetShortName, but that did not help.

Windows XP SP3

MS Access 2007 VBA code:
Code:
Option Compare Database

Public objSendMail As vbSendMail.clsSendMail

Declare Function GetShortPathName Lib "kernel32" _
            Alias "GetShortPathNameA" (ByVal lpszLongPath As String, _
           ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long

Function GetShortName(ByVal sLongFileName As String) As String
           Dim lRetVal As Long, sShortPathName As String, iLen As Integer
           'Set up a buffer area for the API function call return.
           sShortPathName = Space(255)
           iLen = Len(sShortPathName)
    
           'Call the function.
           lRetVal = GetShortPathName(sLongFileName, sShortPathName, iLen)
           'Remove unwanted characters.
           GetShortName = Left(sShortPathName, lRetVal)
 End Function

Function SMTPproc()

Dim strMailTo As String
Dim strMailSubject As String
Dim strMailMsg As String
Dim strMailAtt As String
Dim strMailCc As String

strMailTo = "abc1@def.com"
strMailSubject = "This is the subject of the email"
strMailMsg = "This is the body text of the email"
strMailAtt = "D:\readme.txt"
strMailCc = "abc2@def.com"

Set objSendMail = New vbSendMail.clsSendMail

objSendMail.SMTPHost = "mail.isp.com"

objSendMail.UseAuthentication = False
'objSendMail.Username = "emailUserName"
'objSendMail.Password = "thepassword"

'objSendMail.RecipientDisplayName = ""
objSendMail.ReplyToAddress = "abc3@def.com"
objSendMail.CcRecipient = strMailCc
objSendMail.from = "abc4@def.com"
objSendMail.FromDisplayName = "System Support"
objSendMail.Recipient = strMailTo
objSendMail.Subject = strMailSubject
objSendMail.Message = strMailMsg

' Tried GetShortName, but it did not help, even with a long path...
' The error 429 occurs even with D:\readme.txt...
'objSendMail.Attachment = GetShortName(strMailAtt)
objSendMail.Attachment = strMailAtt

objSendMail.Send
Set objSendMail = Nothing

End Function