I'm trying to use CDO to send email from my application. I have Microsoft Outlook 2000 installed, but no Exchange Server.
I can do this easily using CDONTS, but the client is running Windows 98.
I'm using code directly from the MSDN examples but it's not working for me. It gets to the line objSession.Logon but then it hangs. No dialog pops up or anything. Here's the code from MSDN:
I've tried the objSession.Logon with profile names from Outlook Express. I've tried it with no parameters. I've tried it with empty strings. It hangs every time.
I can do this easily using CDONTS, but the client is running Windows 98.
I'm using code directly from the MSDN examples but it's not working for me. It gets to the line objSession.Logon but then it hangs. No dialog pops up or anything. Here's the code from MSDN:
Code:
Private Sub Command1_Click()
Dim objSession As MAPI.Session ' use early binding for more efficient
Dim objMessage As Message ' code and type checking
Dim objOneRecip As Recipient
On Error GoTo errorMsg
' create a session and log on -- username and password in profile
Set objSession = CreateObject("MAPI.Session")
' change the parameters to valid values for your configuration
objSession.Logon profileName:="Sender Name"
' create a message and fill in its properties
Set objMessage = objSession.Outbox.Messages.Add
objMessage.Subject = "Sample Message"
objMessage.Text = "This is sample message text."
' create the recipient
Set objOneRecip = objMessage.Recipients.Add
objOneRecip.Name = "Recipient Name"
objOneRecip.Type = CdoTo
objOneRecip.Resolve ' get MAPI to determine complete e-mail address
' send the message and log off
objMessage.Send showDialog:=False
MsgBox "The message has been sent"
objSession.Logoff
Exit Sub
errorMsg:
MsgBox "Error!"
End Sub
I've tried the objSession.Logon with profile names from Outlook Express. I've tried it with no parameters. I've tried it with empty strings. It hangs every time.