473,738 Members | 8,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with CDO.configurati on

Hi all,
I am sending mail from my apps with CDO nowadays.
However I have one client where this will not work until now.
I am thinking this is related to the provider where the client has his internet-account.

I am using cdosys with 'late binding'. I try to send mail with an attachment to a few mailaddresses (strTo)
The *exact same code* (with other smtpserver-login and pw strings) does work on various other PC's with various other providers.

The code:
SendCDOMail "Subject... " & Format(Date, "dd-mm-yyyy"), msg, strTo, "C:\svb\output. html"

Sub SendCDOMail(str Subject, strBody, strTo, strAttach)
On Error GoTo Err_SendCDOMail
Const cdoSendUsingPic kup = 1
Const cdoSendUsingPor t = 2 'Must use this to use Delivery Notification
Const cdoAnonymous = 0
Const cdoBasic = 1 ' clear text
Const cdoNTLM = 2 'NTLM
'Delivery Status Notifications
Const cdoDSNDefault = 0 'None
Const cdoDSNNever = 1 'None
Const cdoDSNFailure = 2 'Failure
Const cdoDSNSuccess = 4 'Success
Const cdoDSNDelay = 8 'Delay
Const cdoDSNSuccessFa ilOrDelay = 14 'Success, failure or delay

Dim objMsg As Object
Dim objConf As Object
Dim objFlds As Object

Set objMsg = CreateObject("C DO.Message")
Set objConf = CreateObject("C DO.Configuratio n")

Set objFlds = objConf.Fields
With objFlds
.Item("http://schemas.microso ft.com/cdo/configuration/sendusing") = cdoSendUsingPor t
.Item("http://schemas.microso ft.com/cdo/configuration/smtpserver") = "smtpserver here"
..Item("http://schemas.microso ft.com/cdo/configuration/smtpauthenticat e") = cdoBasic
.Item("http://schemas.microso ft.com/cdo/configuration/sendusername") = "account here"
.Item("http://schemas.microso ft.com/cdo/configuration/sendpassword") = "password here"
.Update
End With

With objMsg
Set .Configuration = objConf
.To = strTo
.Subject = strSubject
.cc = bl*@test.nl
.From = blabl*@test.nl
.TextBody = strBody
.AddAttachment strAttach
.DSNOptions = cdoDSNFailure
.Fields.Update
.Send
End With
Exit Sub

Err_SendCDOMail :
MsgBox Err & " " & Error$, vbCritical, TITEL
End Sub

Thanks for any ideas...
Arno R
Jun 14 '07 #1
7 7282
"Arno R" <ar************ ****@planet.nlw rote in
news:46******** *************** @text.nova.plan et.nl:
Hi all,
I am sending mail from my apps with CDO nowadays.
However I have one client where this will not work until now.
I am thinking this is related to the provider where the client has his
internet-account.
.Item("http://schemas.microso ft.com/cdo/configuration/sendusername")
= "account here"
.From = bl****@test.nl
Some smtp servers seem to require that "account here" and bl****@test.nl be
the same string. I beleve one can avoid this difficulty in general by
omitting the the line

..From = bl****@test.nl

in which case FROM will default to
sendusername
but it's been a long time since I wrote code that used CDO, and I may be
recalling things that never happened.

--
lyle fairfield
Jun 14 '07 #2

"lyle fairfield" <ly******@yahoo .caschreef in bericht news:Rt******** **********@read 1.cgocable.net. ..
"Arno R" <ar************ ****@planet.nlw rote in
news:46******** *************** @text.nova.plan et.nl:
>Hi all,
I am sending mail from my apps with CDO nowadays.
However I have one client where this will not work until now.
I am thinking this is related to the provider where the client has his
internet-account.
> ..Item("http://schemas.microso ft.com/cdo/configuration/sendusername")
= "account here"
> .From = bl****@test.nl
Some smtp servers seem to require that "account here" and bl****@test.nl be
the same string. I beleve one can avoid this difficulty in general by
omitting the the line

.From = bl****@test.nl

in which case FROM will default to
sendusername
but it's been a long time since I wrote code that used CDO, and I may be
recalling things that never happened.

--
lyle fairfield
Hi Lyle,
How are you doing these days???

The answer you give might be very true. I will check that tomorrow at the clients office.
This particular ISP is very restictive indeed.

Arno R
Jun 14 '07 #3

"lyle fairfield" <ly******@yahoo .caschreef in bericht news:Rt******** **********@read 1.cgocable.net. ..
"Arno R" <ar************ ****@planet.nlw rote in
news:46******** *************** @text.nova.plan et.nl:
>Hi all,
I am sending mail from my apps with CDO nowadays.
However I have one client where this will not work until now.
I am thinking this is related to the provider where the client has his
internet-account.
> ..Item("http://schemas.microso ft.com/cdo/configuration/sendusername")
= "account here"
> .From = bl****@test.nl
Some smtp servers seem to require that "account here" and bl****@test.nl be
the same string. I beleve one can avoid this difficulty in general by
omitting the the line

.From = bl****@test.nl

in which case FROM will default to
sendusername
but it's been a long time since I wrote code that used CDO, and I may be
recalling things that never happened.

--
lyle fairfield
Hi Lyle,

I went to the client this afternoon with a modified mde. Alas: Stil no mail sending....
Your solution seemed very promising to me, but apparently this was/is not wat causes the problem.
So I also mailed the techsupport at the ISP with this problem.
I got an automated mai back like "bla bla....... very busy at the moment...... ".
But they "will come back shortly...." Hmmm...I don't have the time to wait for that...

Must be a 'stupid' property somewhere I guess...

Any other ideas ?? Anyone ??
Any free smtp-servers available ??

Arno R
Jun 15 '07 #4

"lyle fairfield" <ly******@yahoo .caschreef in bericht news:Rt******** **********@read 1.cgocable.net. ..
"Arno R" <ar************ ****@planet.nlw rote in
news:46******** *************** @text.nova.plan et.nl:
>Hi all,
I am sending mail from my apps with CDO nowadays.
However I have one client where this will not work until now.
I am thinking this is related to the provider where the client has his
internet-account.
> ..Item("http://schemas.microso ft.com/cdo/configuration/sendusername")
= "account here"
> .From = bl****@test.nl
Some smtp servers seem to require that "account here" and bl****@test.nl be
the same string. I beleve one can avoid this difficulty in general by
omitting the the line

.From = bl****@test.nl

in which case FROM will default to
sendusername
but it's been a long time since I wrote code that used CDO, and I may be
recalling things that never happened.

--
lyle fairfield
Unfortunately the above solution did not work so...
To (try to) solve my problem I created a gmail-account and I tried to use gmail as external smtp-server.
(I found some info o that by Googling)
I came across the initial errormessages by using port 465 and a ssl connection like in :

with objFields
....
.Item("http://schemas.microso ft.com/cdo/configuration/smtpserverport" ) = 455
.Item("http://schemas.microso ft.com/cdo/configuration/smtpusessl") = "true"
end with
BUT.... still no mail has been send ?????

Any ideas ??
I am at lost here !!

Arno R
Jun 16 '07 #5
Arno R wrote:
"lyle fairfield" <ly******@yahoo .caschreef in bericht news:Rt******** **********@read 1.cgocable.net. ..
>"Arno R" <ar************ ****@planet.nlw rote in
news:46******* *************** *@text.nova.pla net.nl:
>>Hi all,
I am sending mail from my apps with CDO nowadays.
However I have one client where this will not work until now.
I am thinking this is related to the provider where the client has his
internet-account.
.Item("http://schemas.microso ft.com/cdo/configuration/sendusername")
= "account here"
.From = bl****@test.nl
Some smtp servers seem to require that "account here" and bl****@test.nl be
the same string. I beleve one can avoid this difficulty in general by
omitting the the line

.From = bl****@test.nl

in which case FROM will default to
sendusername
but it's been a long time since I wrote code that used CDO, and I may be
recalling things that never happened.

--
lyle fairfield

Unfortunately the above solution did not work so...
To (try to) solve my problem I created a gmail-account and I tried to use gmail as external smtp-server.
(I found some info o that by Googling)
I came across the initial errormessages by using port 465 and a ssl connection like in :

with objFields
...
.Item("http://schemas.microso ft.com/cdo/configuration/smtpserverport" ) = 455
.Item("http://schemas.microso ft.com/cdo/configuration/smtpusessl") = "true"
end with
smtpusessl takes a true/false value not a string. Here is some *working*
code I've used. Note that some lines might wrap:

'------------------
' --- CDO Defines (e.g. using GMAIL) :

Private Const cdoSendUsingPic kup = 1 'Send message using the local SMTP
service pickup directory.
Private Const cdoSendUsingPor t = 2 'Send the message using the network
(SMTP over the network).

Private Const cdoAnonymous = 0 'Do not authenticate
Private Const cdoBasic = 1 ' basic (clear-text) authentication
Private Const cdoNTLM = 2 ' NTLM

Private Const cdoMailSMTP_Ser ver As String = "smtp.gmail.com "
Private Const cdoMailSMTP_Por t As Long = 465

Public Function sendCDO_Mail(sT o As String, sSubject As String, sMsg As
String) As Boolean
On Error GoTo errHandler

Dim objMessage As Object, sUserID As String, sPassword As String

sUserID = Nz(DLookup("[cdoMailUserID]", "tblSetting s"), "") '
set your user id here
sPassword = Nz(DLookup("[cdoMailPassword]", "tblSetting s"), "") '
set your password here

If Len(sUserID) 0 Then
Set objMessage = CreateObject("C DO.Message")

With objMessage
.Subject = sSubject
.From = sUserID ' required field
.To = sTo
.TextBody = sMsg

'==This section provides the configuration information for
the remote SMTP server.

..Configuration .Fields.Item("h ttp://schemas.microso ft.com/cdo/configuration/sendusing")
= 2

' Name or IP of Remote SMTP Server

..Configuration .Fields.Item("h ttp://schemas.microso ft.com/cdo/configuration/smtpserver")
= cdoMailSMTP_Ser ver

' Type of authentication, NONE, Basic (Base64 encoded), NTLM

..Configuration .Fields.Item("h ttp://schemas.microso ft.com/cdo/configuration/smtpauthenticat e")
= cdoBasic

' Your UserID on the SMTP server

..Configuration .Fields.Item("h ttp://schemas.microso ft.com/cdo/configuration/sendusername")
= sUserID

' Your password on the SMTP server

..Configuration .Fields.Item("h ttp://schemas.microso ft.com/cdo/configuration/sendpassword")
= sPassword

' Server port (typically 25) - gmail uses 587 or 465

..Configuration .Fields.Item("h ttp://schemas.microso ft.com/cdo/configuration/smtpserverport" )
= cdoMailSMTP_Por t

' Use SSL for the connection (False or True)

..Configuration .Fields.Item("h ttp://schemas.microso ft.com/cdo/configuration/smtpusessl")
= True

'Connection Timeout in seconds (the maximum time CDO will
try to establish a connection to the SMTP server)

..Configuration .Fields.Item("h ttp://schemas.microso ft.com/cdo/configuration/smtpconnectiont imeout")
= 180

.Configuration. Fields.Update
'==End remote SMTP server configuration section==

.Send

sendCDO_Mail = True
End With
End If

Exit Function

errHandler:

Dim nErr As Long, sErr As String
nErr = Err.Number
sErr = Err.Description

Debug.Print "Error in sendCDO_Mail: " & nErr & " - " & sErr

End Function
'------------------------

Good luck!

--
'--------------------------
' John Mishefske
' UtterAccess Editor
' 2007 Microsoft Access MVP
'--------------------------
Jun 17 '07 #6
Hi John,

Thanks a million for your code !!
Because of that code I was able to figure out what was wrong in my code.
smtpusessl takes a true/false value not a string. Here is some *working*
code I've used. Note that some lines might wrap:
Indeed "true" should not be a string but should be the value 'True'.
It actually was the value True, because I was using code like MailOption("SSL ") for that option which was returning a boolean value.
For simplicity reasons I posted 'wrong' code.... :-(

But your code worked, and mine did not, so I was able to find the offending code!
What was wrong?
It appeared that the line .DSNOptions = cdoDSNFailure (or ..DSNOptions = 2) was causing the trouble!
When I omitted that line everything was OK.
Including this line (also in your code) results in mail not being delivered.

So problem solved !
Thanks again!

Arno R
Jun 17 '07 #7
Arno R wrote:
Hi John,

Thanks a million for your code !!
Because of that code I was able to figure out what was wrong in my code.
Glad I could help.
It appeared that the line .DSNOptions = cdoDSNFailure (or .DSNOptions = 2) was causing the trouble!
When I omitted that line everything was OK.
That is for Delivery Status Notification. Here is some additional info
if readers are interested:

http://support.microsoft.com/kb/302839
--
'--------------------------
' John Mishefske
' UtterAccess Editor
' 2007 Microsoft Access MVP
'--------------------------
Jun 17 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1419
by: Maxim | last post by:
If there is a document like this: <Configurations> <Configuration default="true"> ... </Configuration> <Configuration> ...
0
311
by: M. v.d. Bogaard | last post by:
Hi, I am trying to publish some custom Publisher Exceptions using the Exception Management Building Block. When an exception is thrown my application crashes and I get the following error in the eventlog (the default publisher). 1) Exception Information ********************************************* Exception Type: System.Configuration.ConfigurationException Message: Could not create...
0
1619
by: HakonB | last post by:
Hi all I get an exception when trying to deserialize a simple configuration file using XML Serialization. The very long stacktrace can be seen at the bottom of this message. I've see other messages related a similar error but none of the solutions suggested are valid in case :/ I have tracked the problem down to the compilation of the temporary DLL that handles the actual serialization. The following commandline (that is one single...
1
1360
by: Dave | last post by:
Hello I hves some problem in my Web.conficg file. The problem is following: I have created some custom settings in this way: ============================================== <!-- Define handlers of the custom settings for MailManager system --> <configSections> <section name="mySqlSettings" type="System.Configuration.SingleTagSectionHandler" /> </configSections>
0
1210
by: Jorgas | last post by:
Hi! I try to use the configuration application block from the Enterprise Library and have done prework as specified from one of the hands-on labs from that package. When trying to get configuration settings using the ConfigurationManager.GetConfiguration my application, which is a windows service, stops with the following error message (parts of it) written to the event log. "Service cannot be started. System.IO.FileNotFoundException:...
3
3048
by: Bratislav Jevtic | last post by:
Hi, I've just installed Ajax November CTP, changed app according to instructions and I am (was) satisfied. Next step - deployment to server. I'm receiving error: -------------------------------------------------- Message......: Request for ConfigurationPermission failed while attempting to access configuration section 'system.web/deployment'. To allow all callers to access the data for this section, set section attribute
2
1518
by: shapper | last post by:
Hello, I have a contact form in my web site which is working just fine on my computer! When I uploaded my web site to my hosting server I get an error when I SUBMIT my form, i.e., when I click submit to send the email: Security Exception Description: The application attempted to perform an operation not
7
2388
by: Santosh | last post by:
Dear all, i am wrtiing following code for the sending email from the my asp application when i am working on the local machine i will work fine ans send email on the mentioned address. but when i deploy it on the server it doen not work. and also does not give any error. MailMessage newMessage = new MailMessage(); newMessage.From =txtEmail.Text.Trim(); newMessage.To="santosh.shinde@vritti.co.in";...
3
2930
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I cut and paste the following code from msdn help page which it just introduces view and multiview server controls. Here is what I do: in vs studio 2005, File --New Web Site, it brings me to the dir: C:\Visual Studio 2005\WebSites\WebSite1, it creates default.aspx and default.aspx.vb and I pasted the following code into default.aspx. I go to build to build web site and it says:------ Build started: Project:
0
8969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9476
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9263
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6751
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.