Solved

Sending HTMLmail using CDO can't see issue

Posted on 2004-09-22
5
4,576 Views
Last Modified: 2007-11-27
I really would like to send mail in html to sales staff.  I have setup the distibution group in Exchange 2000 with sp3 (CDO.dll version 6.0.6249.0)

I just can't see my issue here. The error I recieve is

 
Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'objMessage.Configuration'

(sitedrive):\SITE\CONTACTUS\../tools/SendMail2k.inc, line 86

Line 86 : Set objMessage.Configuration = objConfig

I know it's long but here is my sendmail file (obvious edits required)

<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows 2000 Library" -->
<%
Function SendMail(inTo, inFrom, inSubject, inBody)
Const cdoSendUsingMethod        =       "http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort          = 2
Const cdoSMTPServer             =       "http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort         =       "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPConnectionTimeout  =       "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdoSMTPAuthenticate       =       "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic                  = 1
Const cdoSendUserName           =       "http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword           =       "http://schemas.microsoft.com/cdo/configuration/sendpassword"

Dim objConfig  ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields     ' As ADODB.Fields

' Get a handle on the config object and it's fields
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields

' Set config fields we care about
With Fields
      .Item(cdoSendUsingMethod)       = cdoSendUsingPort
      .Item(cdoSMTPServer)            = "SERVERNAME"
      .Item(cdoSMTPServerPort)        = 25
      .Item(cdoSMTPConnectionTimeout) = 10
      .Item(cdoSMTPAuthenticate)      = cdoBasic
      .Item(cdoSendUserName)          = "USERNAME"
      .Item(cdoSendPassword)          = "PASSWORD"
      .Update
End With

Set objMessage = Server.CreateObject("CDONTS.NEWMAIL")

Set objMessage.Configuration = objConfig

With objMessage
      .To       = inTo
      .From     = inFrom
      .Subject  = inSubject
      .TextBody = inBody
      .Send
End With

Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing

End Function

Function SendHTMLMail(inTo, inFrom, inSubject, inBody)
Const cdoSendUsingMethod        =       "http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort          = 2
Const cdoSMTPServer             =       "http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort         =       "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPConnectionTimeout  =       "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdoSMTPAuthenticate       =       "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic                  = 1
Const cdoSendUserName           =       "http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword           =       "http://schemas.microsoft.com/cdo/configuration/sendpassword"

Dim objConfig  ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields     ' As ADODB.Fields

' Get a handle on the config object and it's fields
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields

' Set config fields we care about
With Fields
      .Item(cdoSendUsingMethod)       = cdoSendUsingPort
      .Item(cdoSMTPServer)            = "SERVERNAME"
      .Item(cdoSMTPServerPort)        = 25
      .Item(cdoSMTPConnectionTimeout) = 10
      .Item(cdoSMTPAuthenticate)      = cdoBasic
      .Item(cdoSendUserName)          = "USERNAME"
      .Item(cdoSendPassword)          = "PASSWORD"

      .Update
End With

Set objMessage = Server.CreateObject("CDONTS.NEWMAIL")

Set objMessage.Configuration = objConfig

With objMessage
      .BodyFormat = 0
      .MailFormat = 0
      .To       = inTo
      .From     = inFrom
      .Subject  = inSubject
      .TextBody = inBody
      .Send
End With

Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing

End Function
%>

I have marked it urgent as Boss is down my throat to get it done (he's the one that really wants it to be html) So I might be missing something by rushing here.


 
 
 
0
Comment
Question by:nurv-x
  • 2
  • 2
5 Comments
 
LVL 15

Accepted Solution

by:
joeposter649 earned 500 total points
ID: 12125616
Looks like you're mixing up cdo and cdonts...

Try changing
Set objMessage = Server.CreateObject("CDONTS.NEWMAIL")
to
Set objMessage = Server.CreateObject("CDO.Message")
0
 

Author Comment

by:nurv-x
ID: 12126046
It was :
Set objMessage = Server.CreateObject("CDO.Message")


and I would get that it didn't support .bodyformat method.

I referrenced this thread here:
http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_20783503.html

And made the change to cdonts.NewMAil and thats when i gotten the Object doesn't support this property or method: 'objMessage.Configuration'
0
 
LVL 15

Expert Comment

by:joeposter649
ID: 12126105
Don't use bodyformat.  Just use HTMLBody instead of TextBody.

Heres some examples...
http://www.w3schools.com/asp/asp_send_email.asp
0
 

Author Comment

by:nurv-x
ID: 12126481
thanks ..I'll give that a try...I got ulled aside to take care of another issue within the plant floor. I will try this when i am done taking care of this other issue
0
 

Expert Comment

by:alexander_sanchez
ID: 12278617
take a look of this simple form that send email using cdo, i use this and it works:

html code:
</head>

<body background="../images_back/fondo.gif" style="margin-top:0;" STYLE='scrollbar-face-color: #009900; scrollbar-shadow-color: #FFFF00; scrollbar-highlight-color: #FFFF00; scrollbar-3dlight-color: #66FF00; scrollbar-darkshadow-color: #66FF00; scrollbar-track-color: #66FF00; scrollbar-arrow-color: #FFFF00'>
<table width="74%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="left" valign="baseline"> <div align="center"><img src="../TITULOS/contactos.gif" width="248" height="96" align="left"></div></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="center"><form method="post" action="contacto.asp">
        <p><font size="1" face="Verdana, Arial, Helvetica, sans-serif">NOMBRE<br>
          <input name="T1" type="text" onBlur="MM_validateForm('T1','','R');return document.MM_returnValue" size="31">
          <br>
          EMAIL<br>
          <input name="T2" type="text" onBlur="MM_validateForm('T1','','R','T2','','RisEmail');return document.MM_returnValue" size="31">
          <br>
          </font><font size="1" face="Verdana, Arial, Helvetica, sans-serif">PA&Iacute;S<br>
          <select name="t3" size="1">
          <option SELECTED value="ninguno">Seleccione un país
                                  <option value="USA">United states of America
                                  <option value="CAN">Canada
                                  <option value="DEU">Germany
                                  <option value="FRA">France
                                  <option value="GBR">United Kingdom
                                  <option value="IND">India
                                  <option value="">---------------------
                                  <option value="AFG">Afghanistan
                                  <option value="ALB">Albania
                                  <option value="DZA">Algeria
                                  <option value="ASM">American Samoa
                                  <option value="AND">Andorra
                                  <option value="AGO">Angola
                                  <option value="AIA">Anguilla
                                  <option value="ATA">Antarctica
                                  <option value="ATG">Antigua and Barbuda
                                  <option value="ARG">Argentina
                                  <option value="ARM">Armenia
                                  <option value="ABW">Aruba
                                  <option value="AUS">Australia
                                  <option value="AUT">Austria
                                  <option value="AZE">Azerbaijan
                                  <option value="BHS">Bahamas
                                  <option value="BHR">Bahrain
                                  <option value="BGD">Bangladesh
                                  <option value="BRB">Barbados
                                  <option value="BLR">Belarus
                                  <option value="BEL">Belgium
                                  <option value="BLZ">Belize
                                  <option value="BEN">Benin
                                  <option value="BMU">Bermuda
                                  <option value="BTN">Bhutan
                                  <option value="BOL">Bolivia
                                  <option value="BIH">Bosnia and Herzegowina
                                  <option value="BWA">Botswana
                                  <option value="BVT">Bouvet Island
                                  <option value="BRA">Brazil
                                  <option value="IOT">British Indian Ocean Territory
                                  <option value="BRN">Brunei Darussalam
                                  <option value="BGR">Bulgaria
                                  <option value="BFA">Burkina Faso
                                  <option value="BDI">Burundi
                                  <option value="KHM">Cambodia
                                  <option value="CMR">Cameroon
                                  <option value="CPV">Cape Verde
                                  <option value="CYM">Cayman Islands
                                  <option value="CAF">Central African Republic
                                  <option value="TCD">Chad
                                  <option value="CHL">Chile
                                  <option value="CHN">China
                                  <option value="CXR">Christmas Island
                                  <option value="CCK">Cocoa (Keeling) Islands
                                  <option value="COL">Colombia
                                  <option value="COM">Comoros
                                  <option value="COG">Congo
                                  <option value="COK">Cook Islands
                                  <option value="CRI">Costa Rica
                                  <option value="CIV">Cote Divoire
                                  <option value="HRV">Croatia (local name: Hrvatska)
                                  <option value="CUB">Cuba
                                  <option value="CYP">Cyprus
                                  <option value="CZE">Czech Republic
                                  <option value="DNK">Denmark
                                  <option value="DJI">Djibouti
                                  <option value="DMA">Dominica
                                  <option value="DOM">Dominican Republic
                                  <option value="TMP">East Timor
                                  <option value="ECU">Ecuador
                                  <option value="EGY">Egypt
                                  <option value="SLV">El Salvador
                                  <option value="GNQ">Equatorial Guinea
                                  <option value="ERI">Eritrea
                                  <option value="EST">Estonia
                                  <option value="ETH">Ethiopia
                                  <option value="FLK">Falkland Islands (Malvinas)
                                  <option value="FRO">Faroe Islands
                                  <option value="FJI">Fiji
                                  <option value="FIN">Finland
                                  <option value="FXX">France, Metropolitan
                                  <option value="GUF">French Guiana
                                  <option value="PYF">French Polynesia
                                  <option value="ATF">French Southern Territories
                                  <option value="GAB">Gabon
                                  <option value="GMB">Gambia
                                  <option value="GEO">Georgia
                                  <option value="GHA">Ghana
                                  <option value="GIB">Gibraltar
                                  <option value="GRC">Greece
                                  <option value="GRL">Greenland
                                  <option value="GRD">Grenada
                                  <option value="GLP">>Guadeloupe
                                  <option value="GUM">Guam
                                  <option value="GTM">Guatemala
                                  <option value="GIN">Guinea
                                  <option value="GNB">Guinea-Bissau
                                  <option value="GUY">Guyana
                                  <option value="HTI">Haiti
                                  <option value="HMD">Heard and Mc Donald Islands
                                  <option value="HND">Honduras
                                  <option value="HKG">Hong Kong
                                  <option value="HUN">Hungary
                                  <option value="ISL">Iceland
                                  <option value="IDN">Indonesia
                                  <option value="IRN">Iran (Islamic Republic of)
                                  <option value="IRQ">Iraq
                                  <option value="IRL">Ireland
                                  <option value="ISR">Israel
                                  <option value="ITA">Italy
                                  <option value="JAM">Jamaica
                                  <option value="JPN">Japan
                                  <option value="JOR">Jordan
                                  <option value="KAZ">Kazakhstan
                                  <option value="KEN">Kenya
                                  <option value="KIR">Kiribati
                                  <option value="PRK">Korea, Democratic Peoples
                                  Republic of
                                  <option value="KOR">Korea, Republic of
                                  <option value="KWT">Kuwait
                                  <option value="KGZ">Kyrgyzstan
                                  <option value="LAO">Lao Peoples Democratic Republic
                                  <option value="LVA">Latvia
                                  <option value="LBN">Lebanon
                                  <option value="LSO">Lesotho
                                  <option value="LBR">Liberia
                                  <option value="LBY">Libyan Arab Jamahiriya
                                  <option value="LIE">Liechtenstein
                                  <option value="LTU">Lithuania
                                  <option value="LUX">Luxembourg
                                  <option value="MAC">Macau
                                  <option value="MDG">Madagascar
                                  <option value="MWI">Malawi
                                  <option value="MYS">Malaysia
                                  <option value="MDV">Maldives
                                  <option value="MLI">Mali
                                  <option value="MLT">Malta
                                  <option value="MHL">Marshall Islands
                                  <option value="MTQ">Martinique
                                  <option value="MRT">Mauritania
                                  <option value="MVS">Mauritius
                                  <option value="MYT">Mayotte
                                  <option value="MEX">Mexico
                                  <option value="FSM">Micronesia, Federated states
                                  of
                                  <option value="MDA">Moldova, Republic of
                                  <option value="MCO">Monaco
                                  <option value="MNG">Mongolia
                                  <option value="MSR">Montserrat
                                  <option value="MAR">Morocco
                                  <option value="MOZ">Mozambique
                                  <option value="MMR">Myanmar
                                  <option value="NAM">Namibia
                                  <option value="NRU">Nauru
                                  <option value="NPL">Nepal
                                  <option value="NLD">Netherlands
                                  <option value="ANT">Netherlands Antilles
                                  <option value="NCL">New Caledonia
                                  <option value="NZL">New Zealand
                                  <option value="NIC">Nicaragua
                                  <option value="NER">Niger
                                  <option value="NGA">Nigeria
                                  <option value="NIU">Niue
                                  <option value="NFK">Norfolk Island
                                  <option value="MNP">Northern Mariana Islands
                                  <option value="MOR">Norway
                                  <option value="OMN">Oman
                                  <option value="PAK">Pakistan
                                  <option value="PLW">Palau
                                  <option value="PAN">Panama
                                  <option value="PNG">Papua New Guinea
                                  <option value="PRY">Paraguay
                                  <option value="PER">Peru
                                  <option value="PHL">Philippines
                                  <option value="PCN">Pitcairn
                                  <option value="POL">Poland
                                  <option value="PRT">Portugal
                                  <option value="PRI">Puerto Rico
                                  <option value="QAT">Qatar
                                  <option value="REU">Reunion
                                  <option value="ROM">Romania
                                  <option value="RUS">Russian Federation
                                  <option value="RWA">Rwanda
                                  <option value="KNA">Saint Kitts and Nevis
                                  <option value="LCA">Saint Lucia
                                  <option value="VCT">Saint Vincent and the Grenadines
                                  <option value="WSM">Samoa
                                  <option value="SMR">San Marino
                                  <option value="STP">Sao Tome and Principe
                                  <option value="SAU">Saudi Arabia
                                  <option value="SEN">Senegal
                                  <option value="SYC">Seychelles
                                  <option value="SLE">Sierra Leone
                                  <option value="SGP">Singapore
                                  <option value="SVK">Slovakia (Slovak Republic)
                                  <option value="SVN">Slovenia
                                  <option value="SLB">Solomon Islands
                                  <option value="SOM">Somalia
                                  <option value="ZAF">South Africa
                                  <option value="ESP">Spain
                                  <option value="LKA">Sri Lanka
                                  <option value="SHN">St. Helena
                                  <option value="SPM">St. Pierre and Miquelon
                                  <option value="SDN">Sudan
                                  <option value="SUR">Suriname
                                  <option value="SJM">Svalbard and Jan Mayen Islands
                                  <option value="SWZ">Swaziland
                                  <option value="SWE">Sweden
                                  <option value="CHE">Switzerland
                                  <option value="SYR">Syrian Arab Republic
                                  <option value="TWN">Taiwan
                                  <option value="TJK">Tajikistan
                                  <option value="TZA">Tanzania, United Republic
                                  of
                                  <option value="THA">Thailand
                                  <option value="TGO">Togo
                                  <option value="TKL">Tokelau
                                  <option value="TON">Tonga
                                  <option value="TTO">Trinidad and Tobago
                                  <option value="TUN">Tunisia
                                  <option value="TUR">Turkey
                                  <option value="TKM">Turkmenistan
                                  <option value="TCA">Turks and Caicos Islands
                                  <option value="TUV">Tuvalu
                                  <option value="UGA">Uganda
                                  <option value="UKR">Ukraine
                                  <option value="ARE">United Arab Emirates
                                  <option value="UMI">United states Minor Outlying
                                  Islands
                                  <option value="URY">Uruguay
                                  <option value="UZB">Uzbekistan
                                  <option value="VUT">Vanuatu
                                  <option value="VAT">Vatican City state (Holy
                                  See)
                                  <option value="VEN">Venezuela
                                  <option value="VNM">Viet Nam
                                  <option value="VGB">Virgin Islands (British)
                                  <option value="VIR">Virgin Islands (U.S.)
                                  <option value="WLF">Wallisw and Futuna Islands
                                  <option value="ESH">Western Sahara
                                  <option value="YEM">Yeman
                                  <option value="YUG">Yugoslavia
                                  <option value="ZAR">Zaire
                                  <option value="ZMB">Zambia
                                  <option value="ZWE">Zimbabwe
                                  <option value="UNK">Not Listed </select>
          <br>
          COMENTARIO</font><font size="1">s</font><br>
          <textarea rows="5" name="S1" cols="43"></textarea>
          <br>
          <input type="submit" value="enviar" name="B1">
        </p>
        </form></td>
  </tr>
  <tr>
    <td align="center">&nbsp;</td>
  </tr>
  <tr>
    <td align="center"><font face="Arial, Helvetica, sans-serif" size="4" color="#000000">ZULAY
      POGGI GONZALEZ<br>
      Venezuela.<br>
      0414.819.53.50<br>
      Correo electr&oacute;nico:<br>zpoggi@cantv.net
      </font></td>
  </tr>
</table>
</body>
</html>
-----------------------------------------------------------------

ASP CODE:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>


<%
'Dimension variables
Dim objCDOSYSCon

dim mail, nombre,pais,comentario


nombre=Request.Form("T1")
mail =Request.Form("T2")
pais=Request.Form("t3")
comentario=Request.Form("S1")

'Create the e-mail server object
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")

'Set and update fields properties
'Out going SMTP server
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost" 'change this to your websites mail domain

'SMTP port
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport")  = 25

'CDO Port
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2  

'Timeout
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

'bjCDOSYSCon.Fields.Update

'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon

'Who the e-mail is from
objCDOSYSMail.From = mail ' change this to an email address

'Who the e-mail is sent to
objCDOSYSMail.To = "zpoggi@cantv.net,alexander_sanchez@yahoo.com" ' change this to an email address to send the form to

'The subject of the e-mail
objCDOSYSMail.Subject = "Información PuntoVerde" ' change this to your email subject

'Set the e-mail body format (HTMLBody=HTML TextBody=Plain)
objCDOSYSMail.HTMLBody = "<font size=2 face=verdana COLOR=GREEN>"

objCDOSYSMail.HTMLBody = objCDOSYSMail.HTMLBody & "<strong>" & "Nombre" & "</strong>"& nombre & "<br>"
objCDOSYSMail.HTMLBody = objCDOSYSMail.HTMLBody & "<strong>" & "Email: " & "</strong>" & mail & "<br>"
objCDOSYSMail.HTMLBody = objCDOSYSMail.HTMLBody & "<strong>" & "País: " & "</strong>" & pais & "<br>"
objCDOSYSMail.HTMLBody = objCDOSYSMail.HTMLBody &"<strong>" & "Comentarios: " & "</strong>"& Replace(Comentario, vbCrLf, "<br />")  & "<br>" & "<br>"
objCDOSYSMail.HTMLBody = objCDOSYSMail.HTMLBody & "Enviado  " & Now() & "</font>"


'Send the e-mail
objCDOSYSMail.Send

'Close the server mail object
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing

Response.Write "<font style='font-family:arial, verdana;color:green;size:20px;font-weight:bold;'>"
Response.Write "Su mensaje ha sido enviado, pronto le responderemos.Los siguientes datos han sido enviados:"
Response.Write "<center>"
Response.Write "<br>"
Response.Write "<br>"
Response.Write "<br>"
Response.Write "<br>"
Response.Write "Nombre:"
Response.Write nombre
Response.Write "<br>"
Response.Write "Email:"
Response.Write mail
Response.Write "<br>"
Response.Write "País:"
Response.Write pais
Response.Write "<br>"
Response.Write "Comentarios:"
Response.Write comentario
Response.Write "<br>"
Response.Write "</center>"
Response.Write "</font>"
%>



I HOPE IT WILL HELP YOU!

IF YOU HAVE MORE DOUBT ASK ME
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now