|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
CDOSYS help needed
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 = "t***@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 :) Try the sample here:
http://www.aspfaq.com/2026 Show quote "crushando" <crushingd***@hotmail.com> wrote in message news:1147181674.138519.204200@j73g2000cwa.googlegroups.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 = "t***@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 :) > 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/sending_email_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. Show quote "crushando" <crushingd***@hotmail.com> wrote in message news:1147181674.138519.204200@j73g2000cwa.googlegroups.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 = "t***@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 :) > |
|||||||||||||||||||||||