|
 |
asp_cdo thread: Sending email and CDO.Configuration
Message #1 by Jon Sidnell <jon.sidnell@b...> on Wed, 19 Jun 2002 11:06:52 +0100
|
|
Hi
I've been trying to do a CDO.Configuration so that I can send messages
through my company's Exchange Server. I've been following sample code from
the Microsoft website, commenting out code that I don't think is strictly
necessary (and that I don't know what the setting should be). My code is:
<%
Dim FromName, UserSubject, UserComments, i
FromName = Trim(Request.Form("username"))
UserSubject = Trim(Request.Form("subject"))
UserComments = Trim(Request.Form("comments"))
' Setup and send email
Dim objMail
Set objMail = Server.CreateObject("CDO.Message")
Dim objConf
Set objConf = Server.CreateObject("CDO.Configuration")
Dim Flds
Set Flds = objConf.Fields
With Flds
' assume constants are defined within script file
.Item(cdoSendUsingMethod) = 2 ' cdoSendUsingPort
.Item(cdoSMTPServerName) = "xchange1"
.Item(cdoSMTPConnectionTimeout) = 10 ' quick timeout
'.Item(cdoSMTPAuthenticate) = cdoBasic
'.Item(cdoSendUserName) = "username"
'.Item(cdoSendPassword) = "password"
'.Item(cdoURLProxyServer) = "server:80"
'.Item(cdoURLProxyBypass) = "<local>"
'.Item(cdoURLGetLatestVersion) = True
.Update
End With
with objMail
Set .Configuration = objConf
.From = "intrafb@b..."
.Subject = "Intranet Feedback: " & UserSubject
.To = "jon.sidnell@b..."
.TextBody = "From: " & FromName & vbcrlf&_
UserComments
.Send
End with
set objMail = nothing
%>
I keep on getting errors that say "cdoSendUsingMethod" and "cdoSMTPServer"
(and basically all the CDO.Configuration variables in the With Flds...
construct) are undefined. I thought that these variables would be defined
by the 'Set Flds = objConf.Fields' line. Am I doing something wrong?
Also, does anyone know how to send email through Exchange Server? I assume
it will work how I'm trying it, but I'm not 100% sure...
Regards,
Jon Sidnell
This message and any attachments (the "message") are intended solely
for the addressees and are confidential. If you receive this message
in error, please delete it and immediately notify the sender.
Any use not in accord with its purpose, any dissemination or
disclosure, either whole or partial, is prohibited except formal
approval.
The internet can not guarantee the integrity of this message.
BNP PARIBAS LEASE GROUP PLC (and its subsidiaries)
shall (will) not therefore be liable for the message if modified.
Message #2 by "Mike Peschka" <mike@a...> on Wed, 19 Jun 2002 11:52:10 -0400
|
|
Jon-
To get the named constants to work, you'll need to include the following
line either in any code file that uses them or in the global.asa file
for the application.
<!--METADATA NAME=3D"Microsoft CDO For Exchange 2000 Library"
TYPE=3D"TypeLib" UUID=3D"{CD000000-8B95-11D1-82DB-00C04FB1625D}"-->
Hope this helps!
Mike Peschka
-----Original Message-----
From: Jon Sidnell [mailto:jon.sidnell@b...]
Sent: Wednesday, June 19, 2002 6:07 AM
To: ASP CDO
Subject: [asp_cdo] Sending email and CDO.Configuration
Hi
I've been trying to do a CDO.Configuration so that I can send messages
through my company's Exchange Server. I've been following sample code
from the Microsoft website, commenting out code that I don't think is
strictly necessary (and that I don't know what the setting should be).
My code is:
<%
Dim FromName, UserSubject, UserComments, i
FromName =3D Trim(Request.Form("username"))
UserSubject =3D Trim(Request.Form("subject"))
UserComments =3D Trim(Request.Form("comments"))
' Setup and send email
Dim objMail
Set objMail =3D Server.CreateObject("CDO.Message")
Dim objConf
Set objConf =3D Server.CreateObject("CDO.Configuration")
Dim Flds
Set Flds =3D objConf.Fields
With Flds
' assume constants are defined within script file
.Item(cdoSendUsingMethod) =3D 2 ' cdoSendUsingPort
.Item(cdoSMTPServerName) =3D "xchange1"
.Item(cdoSMTPConnectionTimeout) =3D 10 ' quick timeout
'.Item(cdoSMTPAuthenticate) =3D cdoBasic
'.Item(cdoSendUserName) =3D "username"
'.Item(cdoSendPassword) =3D "password"
'.Item(cdoURLProxyServer) =3D "server:80"
'.Item(cdoURLProxyBypass) =3D "<local>"
'.Item(cdoURLGetLatestVersion) =3D True
.Update
End With
with objMail
Set .Configuration =3D objConf
.From =3D "intrafb@b..."
.Subject =3D "Intranet Feedback: " & UserSubject
.To =3D "jon.sidnell@b..."
.TextBody =3D "From: " & FromName & vbcrlf&_
UserComments
.Send
End with
set objMail =3D nothing
%>
I keep on getting errors that say "cdoSendUsingMethod" and
"cdoSMTPServer" (and basically all the CDO.Configuration variables in
the With Flds...
construct) are undefined. I thought that these variables would be
defined by the 'Set Flds =3D objConf.Fields' line. Am I doing something
wrong?
Also, does anyone know how to send email through Exchange Server? I
assume it will work how I'm trying it, but I'm not 100% sure...
Regards,
Jon Sidnell
This message and any attachments (the "message") are intended solely
for the addressees and are confidential. If you receive this message
in error, please delete it and immediately notify the sender.
Any use not in accord with its purpose, any dissemination or
disclosure, either whole or partial, is prohibited except formal
approval.
The internet can not guarantee the integrity of this message.
BNP PARIBAS LEASE GROUP PLC (and its subsidiaries)
shall (will) not therefore be liable for the message if modified.
Message #3 by "Siegfried Weber" <sweber@c...> on Thu, 20 Jun 2002 00:07:58 +0200
|
|
Also note that there is a documentation bug and you need to use:
.Item(cdoSMTPServer) =3D " xchange1.domain.com"
Instead of:
.Item(cdoSMTPServerName) =3D "xchange1"
<Cheers:Siegfried runat=3D"server" />
> -----Original Message-----
> From: Mike Peschka [mailto:mike@a...]
> Sent: Wednesday, June 19, 2002 5:52 PM
> To: ASP CDO
> Subject: [asp_cdo] RE: Sending email and CDO.Configuration
>
> Jon-
> To get the named constants to work, you'll need to include the
following
> line either in any code file that uses them or in the global.asa file
> for the application.
>
> <!--METADATA NAME=3D"Microsoft CDO For Exchange 2000 Library"
> TYPE=3D"TypeLib" UUID=3D"{CD000000-8B95-11D1-82DB-00C04FB1625D}"-->
>
> Hope this helps!
>
> Mike Peschka
>
> -----Original Message-----
> From: Jon Sidnell [mailto:jon.sidnell@b...]
> Sent: Wednesday, June 19, 2002 6:07 AM
> To: ASP CDO
> Subject: [asp_cdo] Sending email and CDO.Configuration
>
>
> Hi
>
> I've been trying to do a CDO.Configuration so that I can send messages
> through my company's Exchange Server. I've been following sample code
> from the Microsoft website, commenting out code that I don't think is
> strictly necessary (and that I don't know what the setting should be).
> My code is:
>
> <%
> Dim FromName, UserSubject, UserComments, i
>
> FromName =3D Trim(Request.Form("username"))
> UserSubject =3D Trim(Request.Form("subject"))
> UserComments =3D Trim(Request.Form("comments"))
>
> ' Setup and send email
> Dim objMail
> Set objMail =3D Server.CreateObject("CDO.Message")
> Dim objConf
> Set objConf =3D Server.CreateObject("CDO.Configuration")
>
> Dim Flds
> Set Flds =3D objConf.Fields
>
> With Flds
> ' assume constants are defined within script file
> .Item(cdoSendUsingMethod) =3D 2 ' cdoSendUsingPort
> .Item(cdoSMTPServerName) =3D "xchange1"
> .Item(cdoSMTPConnectionTimeout) =3D 10 ' quick timeout
> '.Item(cdoSMTPAuthenticate) =3D cdoBasic
> '.Item(cdoSendUserName) =3D "username"
> '.Item(cdoSendPassword) =3D "password"
> '.Item(cdoURLProxyServer) =3D "server:80"
> '.Item(cdoURLProxyBypass) =3D "<local>"
> '.Item(cdoURLGetLatestVersion) =3D True
> .Update
> End With
>
> with objMail
> Set .Configuration =3D objConf
> .From =3D "intrafb@b..."
> .Subject =3D "Intranet Feedback: " & UserSubject
> .To =3D "jon.sidnell@b..."
> .TextBody =3D "From: " & FromName & vbcrlf&_
> UserComments
> .Send
> End with
> set objMail =3D nothing
> %>
>
> I keep on getting errors that say "cdoSendUsingMethod" and
> "cdoSMTPServer" (and basically all the CDO.Configuration variables in
> the With Flds...
> construct) are undefined. I thought that these variables would be
> defined by the 'Set Flds =3D objConf.Fields' line. Am I doing
something
> wrong?
>
> Also, does anyone know how to send email through Exchange Server? I
> assume it will work how I'm trying it, but I'm not 100% sure...
>
> Regards,
> Jon Sidnell
>
> This message and any attachments (the "message") are intended solely
> for the addressees and are confidential. If you receive this message
> in error, please delete it and immediately notify the sender.
>
> Any use not in accord with its purpose, any dissemination or
> disclosure, either whole or partial, is prohibited except formal
> approval.
>
> The internet can not guarantee the integrity of this message.
> BNP PARIBAS LEASE GROUP PLC (and its subsidiaries)
> shall (will) not therefore be liable for the message if modified.
>
>
|
|
 |