Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDO Hangs at Session::Logon

Status
Not open for further replies.

davewelsh

Programmer
Jun 26, 2001
71
CA
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:

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.
 
I just wanted to add that I can send mail fine using the MAPI controls, but I can only send plain text that way and I want to send content type text/html.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top