|
-
Mar 5th, 2009, 01:05 PM
#1
Thread Starter
PowerPoster
Sending Emails Using CDO On Vista
 Originally Posted by si_the_geek
I regularly work with lots of files, and Vista causes no problems with it... but then I don't rename system DLL's (which is not a great idea anyway, even when testing your apps).
After I'd got everything installed and set up (with all the software I use, about two weeks!) the only issue I have with Vista is that I need to confirm when I open VB6.. which is a very minor inconvenience.
I was having a problem with sending emails using cdo on Vista, worked fine xp. Noticed the cdosys.dll on vista was less than 1/2 the size of the cdosys.dll so i renamed the one on vista and used the one from xp. Still did not work. I don't like getting access denied when trying to view the contents of some folders. I am admin and should be able to do what i want.
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders 
-
Mar 5th, 2009, 01:26 PM
#2
Re: Sending Emails Using CDO On Vista
One thread, one topic please. 
Split into its own thread
Define "a problem".
-
Mar 5th, 2009, 02:09 PM
#3
Re: Sending Emails Using CDO On Vista
The size is pretty much irrelevant, as like with many things the functionality is likely to be spread across multiple files - and as it is for a later version of Windows, parts of it may have been moved into system file(s) which are shared with other components.
Not only that, but assuming CDO uses multiple files anyway, you need all of them to be compatible with each other... and copying just one won't do that. In fact, copying may not work at all (you are likely to need to Register too, after of course unregistering the old ones).
I don't like getting access denied when trying to view the contents of some folders. I am admin and should be able to do what i want.
As you are an Admin it should just ask you if you want permission, and then set it all up for you (unlike previous versions of Windows, where you needed to do it manually). Once it is set, it doesn't need to be set again.
-
Mar 5th, 2009, 07:23 PM
#4
Re: Sending Emails Using CDO On Vista
After much cutting and trying and reading of documentation here is what I have concluded.
It can get complicated for many reasons.
There are two different DLLs that can provide objects with the progID "CDO.Message" and so on, as well as the matching classID values. Normally these come from cdosys.dll unless you have MS Outlook installed in "corporate or workgroup" mode. Then cdoex.dll is installed and registered with these progID/classID values.
Because they are binary compatible, a VB6 program could be compiled against either reference (CDO for Windows 2000 vs. CDO for Exchange).
Also, on OSs besides Vista it is possible to install the IIS SMTP/NNTP Service. If done, this alters the source that CDO will use for its default Configuration. Normally the default source is Outlook Express and CDO takes the default email account in Outlook Express for the current user's profile. But if the SMTP Service was installed the default configuration is to use the pickup directory configured for the SMTP Service.
If you create and send a Message without setting the Configuration, CDO will use these defaults.
In many cases, the default configuration settings are sufficient to send and post messages successfully. The default configuration settings depend on the software installed on the computer on which you are using the CDO component. When you send messages without associating a Configuration object, these defaults are used; for example, if the computer has the SMTP service installed, the default configuration for sending messages is to write them into files in the SMTP pickup directory. Additionally, various settings can be loaded from Microsoft® Outlook® Express if it is installed. For more information about default settings, see the configuration fields section of the reference.
Configuration CoClass
While Vista cannot have the SMTP Service installed, it also does not come with Outlook Express! Instead Microsoft provided a similar Windows Mail client that CDO cannot get settings from.
CDO can still work two ways in Vista.
If you have Outlook 2000 through 2003 installed, or Outlook 2007 with an add-on download, set up in corporate/workgroup mode, it should default to using the current user's Exchange email account.
With or without Outlook, you can provide a Configuration that uses an external SMTP server.
I have been able to get the latter working under Vista in two machines, one with Outlook corporate/workgroup set up (CDOEX) and one without (CDOSYS). You have to provide a full SMTP Configuration though, it cannot auto-load a default because there is none to load!
-
Mar 5th, 2009, 07:32 PM
#5
Re: Sending Emails Using CDO On Vista
Working example (fill in values as noted):
Code:
Option Explicit
'
'For Windows 2000 or later. Requires a reference to:
'
' Microsoft CDO For Windows Library
'
Private Sub SendMsg()
Dim cdoMsg As New CDO.Message
With cdoMsg
With .Configuration.Fields
.Item(cdoSendUsingMethod).Value = cdoSendUsingPort
.Item(cdoSMTPServerPort).Value = 25
.Item(cdoSMTPServer).Value = "DNS.NAME.OF.SMTP.SERVER"
.Item(cdoSendUserName).Value = "USERNAME"
.Item(cdoSendPassword).Value = "PASSWORD"
.Item(cdoSMTPAuthenticate).Value = cdoBasic
.Update
End With
.From = """SENDER NAME"" <[email protected]>"
.To = """RECIP NAME"" <[email protected]>"
.Subject = "Some more really spiffy mail for you!"
.TextBody = "This is some mail I think you'll want." & vbNewLine _
& "Be sure to read the attachment."
.AddAttachment App.Path & "\attach.txt"
On Error Resume Next
.Send
End With
If Err.Number <> 0 Then
MsgBox "CDO error " & Hex$(Err.Number) & vbNewLine & Err.Description, _
vbOKOnly Or vbExclamation, _
Caption
Else
MsgBox "Mail sent!", vbOKOnly, Caption
End If
End Sub
Private Sub Command1_Click()
Command1.Enabled = False
SendMsg
End Sub
If your SMTP server requires secure authentication you'd change that line from Basic of course. If you need SSL/TLS you'd add that parameter, etc.
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
|