Professional Shared, Reseller and Dedicated Rainbow Portal Hosting Service Provider Cheap and reliable Rainbow Portal hosting service provider - Rainbow Marts LiveZilla Live Help

Rainbow Portal Hosting Customer Support Center

Main Menu
Home
Open a Ticket
My Ticket History
Browse Knowledgebase
My Account

Login
 E-mail:
 Password:
Register | Forgot Password?

Knowledgebase
Ask a question using natural language. Try to include as much information as possible:


Contact Us
Database Mart LLC
7017 Weis Drive
Galveston, TX 77551
USA
409-877-4238

Sales & Billing: 8:00AM-5:00PM CST
Technical Support: 24x7x365

Knowledgebase
sample code of sending email using CDOSYS
Top : General Technical Support : Programming

Article ID: 000086
Rating: 3.0 / 5.0 (2 votes)
Views: 3484

Problem
If you are using CDOSYS to send email in your code,you can compare this code with your own.

copy the following code to a new ASP code page and replace from@domain.com,to@domain.com with your from/to email address and test it out.

Solution
<%
'Send email using CDOSYS

If SendMessage("from@domain.com","to@domain.com", "", "Test message using CDOSYS",Request.ServerVariables("SERVER_NAME"), 0) Then
Response.Write "CDOSYS message test successfully!<BR>"
Else
Response.Write "CDOSYS message test failed!<BR>"
End If
%>

<%
Public Function SendMessage(strFrom, strTo, strBcc, strSubject, strBody,intMessageFormat)
Dim objMail, objConf
Dim bitSuccess

'On Error Resume Next
bitSuccess = False
Set objMail = Server.CreateObject("CDO.Message")

If IsObject(objMail) Then
Set objConf = Server.CreateObject("CDO.Configuration")
objConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
objConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpport") = "25"
'objConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
'objConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\Inetpub\mailroot\Pickup"
objConf.Fields.Update
objMail.Configuration = objConf

If strFrom <> "" Then
objMail.From = strFrom
Else
objMail.From = "Guest"
End If

objMail.To = strTo
objMail.Bcc = strBcc
objMail.Subject = strSubject

If intMessageFormat = 1 Then 'Text
objMail.TextBody = strBody
Else
objMail.HTMLBody = strBody
End If

objMail.Send
bitSuccess = True

Set objConf = Nothing
Set objMail = Nothing
End If

SendMessage = bitSuccess
End Function

%>

Rating
Did you find this article helpful?

Shared Rainbow Portal Hosting - Reseller Rainbow Portal Hosting - Dedicated Rainbow Portal Hosting - Domain Registration - SSL Certificates
Home - Support Center - Knowledgebase - Documentation - Flash Tutorials - Our Network - About Us - Site Map
Cheap and reliable Rainbow Portal hosting service provider - Rainbow Marts