Abundant Technologies - IT Consulting Experts

 Source Code Library

 Code Details

 
Dim msgMail As String Public Const msgMailFailed = "Mail login failed." _ & " Click Retry to attempt logon again or Cancel." Public Function opnMail(mpsMAPI As Control, mpmMAPI As Control, vUserName As String, vPassword As String) As Boolean On Error Resume Next opnMAPI = False mpsMAPI.UserName = vUserName mpsMAPI.Password = vPassword mpsMAPI.DownloadMail = False mpsMAPI.LogonUI = False mpsMAPI.SignOn If Err <> 0 Then Err.Clear mpsMAPI.LogonUI = True Else opnMail = True End If Do Until opnMail mpsMAPI.SignOn If Err <> 0 Then If Not MsgBox(msgMailFailed, 21) <> 2 Then Exit Do End If Else opnMail = True End If DoEvents Err.Clear Loop mpmMAPI.SessionID = mpsMAPI.SessionID DoEvents End Function Public Function sndAttachment(mpmMAPI As Control, rMsgNoteText As String, rAttachmentName As String, rAttachmentPathName As String, rMsgSubject As String, rRecipDisplayName As String, rAddressResolveUI As Boolean, rTestMode As Boolean) As Boolean Dim rRecipIndex As Integer Dim rPos As Integer Dim Name As String On Error Resume Next sndAttachment = False mpmMAPI.Compose mpmMAPI.MsgNoteText = rMsgNoteText & " " mpmMAPI.AttachmentPosition = Len(rMsgNoteText) mpmMAPI.AttachmentName = rAttachmentName mpmMAPI.AttachmentPathName = rAttachmentPathName mpmMAPI.MsgSubject = rMsgSubject rRecipIndex = -1 Do While rRecipDisplayName <> "" rPos = InStr(rRecipDisplayName, ";") If rPos <= 1 Then Name = Trim(rRecipDisplayName) rRecipDisplayName = "" Else Name = Trim(Left(rRecipDisplayName, rPos - 1)) rRecipDisplayName = "" & Trim(Right(rRecipDisplayName, _ Len(rRecipDisplayName) - rPos)) End If If Name <> "" Then rRecipIndex = rRecipIndex + 1 mpmMAPI.RecipIndex = rRecipIndex mpmMAPI.RecipDisplayName = Name mpmMAPI.RecipAddress = "" mpmMAPI.AddressResolveUI = rAddressResolveUI If rTestMode Then mpmMAPI.AddressResolveUI = rTestMode End If mpmMAPI.ResolveName End If Loop DoEvents If Err = 0 Then mpmMAPI.Send rTestMode End If If Err = 0 Then sndAttachment = True Else mpmMAPI.Compose Err.Clear End If DoEvents End Function Public Sub clsMail(mpsMAPI As Control) On Error Resume Next mpsMAPI.SignOff DoEvents End Sub

Mail To: info@3pc.com