469,917 Members | 1,642 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

CDOSYS help needed

hi

i'm new to ASP and have to deal with some email scripting at the very
start.I've collected some script pieces from a variaty of tutorial
pages but haven't been able to send any mails yet. I'm pasting the
latest version of the code:

<%

Dim sMsg
Dim sTo
Dim sFrom
Dim sSubject
Dim sTextBody

sTo = "te**@blabla.com"
sFrom = "cr***@bonbon.com"
sSubject = "Insert here your subject text"
sTextBody = "Insert here your plain body text"

Dim objMail, oMailConfig

'Create the mail object
Set objMail = Server.CreateObject("CDO.Message")
Set oMailConfig = Server.CreateObject ("CDO.Configuration")

oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= "localhost"
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= 25
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing")
= 2
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")
= 60
oMailConfig.Fields.Update

Set objMail.Configuration = oMailConfig
'Set key properties
objMail.From = sFrom
objMail.To = sTo
objMail.Subject= sSubject
objMail.TextBody = sTextBody

'Send the email

objMail.Send

'Clean-up mail object
Set objMail = Nothing
%>

As I said before i'm very new to ASP so i might be even missing a very
basic stuff. I've tried the code without the configuration part as well
but nothing has changed. Actually it seems that the problem is about
objMail.Send part. When I comment it the script runs fine but when I
activate it the page is not accessible (that's another problem that
i've come up with ASP. There's no error messages but a page error.
Should I catch an exception to see what's wrong or do I need to check
some other stuff?)
I wasn't sure about the VB syntax style so I also tried objMail.Send()
My script is running on IIS 6 server so I don't think there's a support
problem with CDOSYS

Any help and/or advise is appreciated muchly
Thanks :)

May 10 '06 #1
2 2240
Try the sample here:
http://www.aspfaq.com/2026


"crushando" <cr**********@hotmail.com> wrote in message
news:11**********************@j73g2000cwa.googlegr oups.com...
hi

i'm new to ASP and have to deal with some email scripting at the very
start.I've collected some script pieces from a variaty of tutorial
pages but haven't been able to send any mails yet. I'm pasting the
latest version of the code:

<%

Dim sMsg
Dim sTo
Dim sFrom
Dim sSubject
Dim sTextBody

sTo = "te**@blabla.com"
sFrom = "cr***@bonbon.com"
sSubject = "Insert here your subject text"
sTextBody = "Insert here your plain body text"

Dim objMail, oMailConfig

'Create the mail object
Set objMail = Server.CreateObject("CDO.Message")
Set oMailConfig = Server.CreateObject ("CDO.Configuration")

oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= "localhost"
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= 25
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing")
= 2
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")
= 60
oMailConfig.Fields.Update

Set objMail.Configuration = oMailConfig
'Set key properties
objMail.From = sFrom
objMail.To = sTo
objMail.Subject= sSubject
objMail.TextBody = sTextBody

'Send the email

objMail.Send

'Clean-up mail object
Set objMail = Nothing
%>

As I said before i'm very new to ASP so i might be even missing a very
basic stuff. I've tried the code without the configuration part as well
but nothing has changed. Actually it seems that the problem is about
objMail.Send part. When I comment it the script runs fine but when I
activate it the page is not accessible (that's another problem that
i've come up with ASP. There's no error messages but a page error.
Should I catch an exception to see what's wrong or do I need to check
some other stuff?)
I wasn't sure about the VB syntax style so I also tried objMail.Send()
My script is running on IIS 6 server so I don't think there's a support
problem with CDOSYS

Any help and/or advise is appreciated muchly
Thanks :)

May 10 '06 #2
there are a lot of different ways to send email using cdosys, these article
goes over that in detail
http://www.powerasp.com/content/new/...ail_cdosys.asp

Your just trying one... and by saying your email server is "localhost" that
may or may not be valid.

Ultimately you have to ask your server admins what settings you should be
using to send an email with CDOSYS.
If it is your local server that knowledge all rides on you.


"crushando" <cr**********@hotmail.com> wrote in message
news:11**********************@j73g2000cwa.googlegr oups.com...
hi

i'm new to ASP and have to deal with some email scripting at the very
start.I've collected some script pieces from a variaty of tutorial
pages but haven't been able to send any mails yet. I'm pasting the
latest version of the code:

<%

Dim sMsg
Dim sTo
Dim sFrom
Dim sSubject
Dim sTextBody

sTo = "te**@blabla.com"
sFrom = "cr***@bonbon.com"
sSubject = "Insert here your subject text"
sTextBody = "Insert here your plain body text"

Dim objMail, oMailConfig

'Create the mail object
Set objMail = Server.CreateObject("CDO.Message")
Set oMailConfig = Server.CreateObject ("CDO.Configuration")

oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= "localhost"
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= 25
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing")
= 2
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")
= 60
oMailConfig.Fields.Update

Set objMail.Configuration = oMailConfig
'Set key properties
objMail.From = sFrom
objMail.To = sTo
objMail.Subject= sSubject
objMail.TextBody = sTextBody

'Send the email

objMail.Send

'Clean-up mail object
Set objMail = Nothing
%>

As I said before i'm very new to ASP so i might be even missing a very
basic stuff. I've tried the code without the configuration part as well
but nothing has changed. Actually it seems that the problem is about
objMail.Send part. When I comment it the script runs fine but when I
activate it the page is not accessible (that's another problem that
i've come up with ASP. There's no error messages but a page error.
Should I catch an exception to see what's wrong or do I need to check
some other stuff?)
I wasn't sure about the VB syntax style so I also tried objMail.Send()
My script is running on IIS 6 server so I don't think there's a support
problem with CDOSYS

Any help and/or advise is appreciated muchly
Thanks :)

May 10 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Serge Myrand | last post: by
1 post views Thread by Paxton | last post: by
14 posts views Thread by Neil Ginsberg | last post: by
8 posts views Thread by Akbur | last post: by
2 posts views Thread by mister-Ed | last post: by
9 posts views Thread by paulmitchell507 | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.