Changing From ASP to CDONTS (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


Brad -> Changing From ASP to CDONTS (7/1/2003 16:32:08)

Dangit!!! I switched my web host and the new host (Microsoft' s bCentral) does not support ASP mail. I had lots of little scripts and now they don' t work. IS this what I should be looking for....

Set Mailer = Server.CreateObject (" SMTPsvg.Mailer" )

and change the SMTPsvg.Mailer to

Set Mailer = CreateObject(" CDONTS.NewMail" )

or something like that? There is also sometimes SetMailer1 and SetMailer2




Spooky -> RE: Changing From ASP to CDONTS (7/1/2003 16:47:32)

Thats the mail code, yes :)
However, there are a few different formats as you see below. That will need changing too.


ASPMail
oMail.RemoteHost = strServer
oMail.AddRecipient strTo, strTo
oMail.FromName = strFrom
oMail.FromAddress = strFrom
oMail.Subject = strSubject
oMail.BodyText = strBody
oMail.SendMail

CDONTS
oMail.To = strTo
oMail.BodyFormat = 1
oMail.MailFormat = 0
oMail.From = strFrom
oMail.Subject = strSubject
oMail.Body = strBody
oMail.Send




Brad -> RE: Changing From ASP to CDONTS (7/1/2003 16:57:34)

Does it make any difference what the name of the Mailer is? Like in your example you have " oMailer" on my site it' s just Mailer or Mailer1 or Mailer2.

Also I have seen objMail and others...any difference?




Spooky -> RE: Changing From ASP to CDONTS (7/1/2003 17:02:35)

Yes, it does matter what its called, but only on your page.
You must use the same object name in each script
eg :

Set Mailer = Server.CreateObject (" SMTPsvg.Mailer" )
Mailer.RemoteHost = strServer
Mailer.AddRecipient strTo, strTo
Mailer.FromName = strFrom

Set ThisMail = Server.CreateObject (" SMTPsvg.Mailer" )
ThisMail.RemoteHost = strServer
ThisMail.AddRecipient strTo, strTo
ThisMail.FromName = strFrom




Brad -> RE: Changing From ASP to CDONTS (7/1/2003 17:31:20)

Okay...awesome. So, if my page is currently this:


-----------------------------------------------------------------------------------------------------

Set rsPass = dbquery(passRet,con)
if not rsPass.eof then
Password = rsPass(0)
Email = rsPass(1)
FromName = " Administrator"
FromEmail = Application(" AdminEmail" )
Subject = " Your Password."
BodyText = " Dear " &FirstName&" " &LastName&" ," &vbcrlf&vbcrlf&" your password is " &Password&" ." &vbcrlf&" Thankyou for using our services " &vbcrlf&vbcrlf&" Regards," &vbcrlf&" Administrator."
Set Mailer = Server.CreateObject (" SMTPsvg.Mailer" )
Mailer.FromName = FromName
Mailer.FromAddress = FromEmail
Mailer.Subject = Subject
Mailer.BodyText = BodyText
Mailer.RemoteHost = " mail-fwd.boca15-verio.com"
Mailer.AddRecipient FirstName&" " &LastName , Email
if Mailer.SendMail then
mailSent = True
else
' Message send failure
mailSent = False
end if
Set Mailer = Nothing


------------------------------------------------------------------------------------------------------


And I want it to go CDONTS I would make it:


-----------------------------------------------------------------------------------------------------

Set rsPass = dbquery(passRet,con)
if not rsPass.eof then
Password = rsPass(0)
Email = rsPass(1)
FromName = " Administrator"
FromEmail = Application(" AdminEmail" )
Subject = " Your Password."
BodyText = " Dear " &FirstName&" " &LastName&" ," &vbcrlf&vbcrlf&" your password is " &Password&" ." &vbcrlf&" Thankyou for using our services " &vbcrlf&vbcrlf&" Regards," &vbcrlf&" Administrator."
Set Mailer = CreateObject(" CDONTS.NewMail" )

Mailer.From = FromName
Mailer.MailFormat = 0 Mailer.Subject = Subject
Mailer.Body = BodyText

Mailer.To FirstName&" " &LastName , Email
if Mailer.Send then
mailSent = True
else
' Message send failure
mailSent = False
end if
Set Mailer = Nothing




Spooky -> RE: Changing From ASP to CDONTS (7/1/2003 17:34:40)

Like so :
Set Mailer = CreateObject(" CDONTS.NewMail" ) 
Mailer.From = FromName
Mailer.BodyFormat = 1 
Mailer.MailFormat = 0 
Mailer.Subject = Subject 
Mailer.Body = BodyText 
Mailer.To = Email 
Mailer.Send
Set Mailer = Nothing 

There isnt any error handling in CDO, so theres no need for the if/then stuff.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.90625