Public Function SendThis(strSubject As String, strBody As String, strFileName As String) As Boolean
With <FormName>.Controls(<The MAPISession Control name>) 'the form name is where You place the MAPISession
' Set DownLoadMail to False to prevent immediate download.
.DownLoadMail = 0
.LogonUI = -1 ' Use the underlying email system's logon UI.
.SignOn ' Signon method.
.NewSession = -1
<FormName>.Controls(<The MAPIMessage Control name>).SessionID = .SessionID ' You must set this before continuing.
End With
With <FormName>.Controls(<The MAPIMessage Control name>)
.Compose
.MsgIndex = -1 '.MsgCount - 1
.RecipIndex = .RecipCount
.RecipType = 1
.RecipAddress = <The mail address(es)>
.ResolveName
.MsgSubject = strSubject
.MsgNoteText = strBody
.AttachmentIndex = .AttachmentCount
.AttachmentType = 0
.AttachmentName = ""
.AttachmentPathName = strFileName 'File name with full path
.Send '-1
SendThis = -1
End With
<FormName>.Controls(<The MAPISession Control name>).SignOff
Exit Function
errLogInFail:
Select Case Err.Number
Case 32003
MsgBox "Conection Canceled!", vbCritical
Case 32001
MsgBox "Canceled by User!", vbExclamation
Case Else
MsgBox Err.Number & " " & Err.Description & vbNewLine & "Please note this number and text and send it to programmer!", vbCritical
End Select
<FormName>.Controls(<The MAPISession Control name>).SignOff
SendThis = 0
Exit Function
End Function
Whatch out the <> symbols means You have to insert the stuff!!
You may have some diff! tiborpalko@hotmail.com