|
-
March 28th, 2001, 02:58 AM
#1
MAPI components -Urgent !!
Pls help me out of this send-email issue.
Program stop at executing the line --
---Messages1.ResolveName
An error msg prompt out-" unknown recipient ".
======================================
Private Sub SendMail(pintMailMode As Integer, Optional intWmsorMax As Integer)
Dim intPlOrPk As Integer
'On Error Resume Next
MAPISession1.LogonUI = False
MAPISession1.UserName = "XXXXXXXXX"
MAPISession1.Password = "XXXXXX"
MAPISession1.SignOn
If Err.Number <> 0 Then
MsgBox "Invalid signon attempt,please try agian "
Exit Sub
End If
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.MsgIndex = -1
MAPIMessages1.Compose
MAPIMessages1.MsgSubject = " Daily Intigrity Checking"
MAPIMessages1.MsgNoteText = " "
MAPIMessages1.AttachmentName ="win"
MAPIMessages1.AttachmentPathName ="c:\windows\win.ini"
MAPIMessages1.AttachmentType = mapData
MAPIMessages1.RecipDisplayName = "PENTRAC - Tan, Lye Chuan"
MAPIMessages1.RecipAddress= "[email protected]"
MAPIMessages1.ResolveName
MAPIMessages1.Send False
MAPISession1.SignOff
ProcExit:
Exit Sub
ProcError:
msgbox Err.Description
End Sub
-
March 28th, 2001, 08:15 AM
#2
Re: MAPI components -Urgent !!
Try this code. It works
Option Explicit
'2 controls Microsoft MAPI Control 6.0 -> MAPISession and MAPIMessages
Private Sub Command1_Click()
Dim msg As String
Screen.MousePointer = vbHourglass
msg = "This is a test email"
With Me
.MAPILogOn.SignOn ' use current user
Do While .MAPILogOn.SessionID = 0
DoEvents ' need to wait until the new session is created
Loop
Call SendToEmail("[email protected]", msg)
.MAPILogOn.SignOff
End With
Screen.MousePointer = vbNormal
End Sub
Private Sub SendToEmail(ByVal Email As String, ByVal msg As String)
With MAPIMessages1
'create a new message and address it
.SessionID = MAPILogOn.SessionID
.Compose
.RecipDisplayName = Email
.AddressResolveUI = True
.RecipAddress = "smtp:" & Email
.MsgSubject = "VB GENERATED E-MAIL"
.MsgNoteText = msg
'if True then open Netscape and wait, if false then sends to Eudora.
.Send False
End With
End Sub
Iouri Boutchkine
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|