[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


cdonts example

Posted on 2002-05-28
Medium Priority
Last Modified: 2010-05-18

I have a database of registered users who I want to send an email to.

Can someone show me a script using CDONTS that will do the following:
Drag the names and email addresses from the database and send each an email with the subject and message taken from a form on the previous page.

Cheers all
Question by:englishman
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
  • +1
LVL 46

Expert Comment

ID: 7039697
I haven't tested this, but it should put you on the right path:

strSubject = request.form("strSubject")
memMessage = request.form("memMessage")

if not IsObject("ojbConnectionMailProcess") then
     set ojbConnectionMailProcess=Server.CreateObject("ADODB.Connection")
     strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;"_
                    + " Data Source= " & strDataPath & ";"_
                    + " Mode=Share Deny None;User Id=admin;PASSWORD=;"

     ojbConnectionMailProcess.ConnectionTimeout = 15
     ojbConnectionMailProcess.CommandTimeout =  10
     if ojbConnectionMailProcess.state = 0 then
          ojbConnectionMailProcess.Open strConnectString
     end if
end if

if not isObject("objRSStaff") then
     set objRSStaff=Server.CreateObject("ADODB.RecordSet")
end if
strSQL = "SELECT * FROM lu_staff WHERE " & SomeCondition
objRSStaff.Open strSQL,ojbConnectionMailProcess,adOpenKeyset,adLockOptimistic

dim objMail
set objMail = CreateObject("CDONTS.Newmail")

do until objRSStaff.eof

     objMail.From = You@YourAddress.com
     objMail.To = objRSStaff("strEmailAddress")  
     objMail.Subject = strSubject
     objMail.Body = memMessage

Set objMail = Nothing
LVL 46

Expert Comment

ID: 7039698
I forgot to close the recordset and connection objects and then set them to nothing.

Fritz the Blank
LVL 18

Accepted Solution

mgfranz earned 400 total points
ID: 7040316
Heres one I use;

Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires= Now()

position = Session("position")

If position <> "" Then
     thePosition = "and is interested in the <b>"&Session("position")&"</b> position."
     thePosition = ". "
End If

fName = Request("firstName")
lName = Request("lastName")
eMail = Request("email")
fileName = Request("filename")

' Send a reply email to the user.

strFrom = "xxxxxxxxxxxx <noreturn@xxxxxxx.com>"
strSubject = "Your Resume has been received"

' Create the message body for the user to receive
strBody = "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">" & vbCrLf _
          & "<html>" & vbCrLf _
          & "<head>" & vbCrLf _
          & " <title>Resume received</title>" & vbCrLf _
          & " <meta http-equiv=Content-Type content=""text/html; charset=iso-8859-1"">" & vbCrLf _
          & "</head>" & vbCrLf _
          & "<body bgcolor=""#4040ff"" style=""font-family : Arial, Helvetica, sans-serif; color : #ffffff;"">" & vbCrLf _
          & " <h3>We have received your Resume</h3><p>" & vbCrLf _
          & " <p>" & vbCrLf _
          & "  Thank you for your interest in employment opportunities with xxxxxxxxxx. " & vbCrLf _
          & "  <p>Our recruiters will review your qualifications and if they match our job requirements a recruiter will contact you. " & vbCrLf _
          & "  <p>We wish you the best of luck with your employment search." & vbCrLf _
          & "  <p>Sincerely,<br>Human Resources, " & vbCrLf _
          & "</body>" & vbCrLf _
          & "</html>" & vbCrLf
Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.From    = strFrom
objCDO.To      = eMail
objCDO.Subject = strSubject
objCDO.Body    = strBody

objCDO.BodyFormat = 1 ' CdoBodyFormatHTML
objCDO.MailFormat = 0 ' CdoMailFormatMime
'objCDO.Cc  = "user@domain.com;user@domain.com"
'objCDO.Bcc = "hr@xxxxxxxx.com"

' Send the message!
Set objCDO = Nothing

Pretty simple really... ;-)
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 18

Expert Comment

ID: 7040326
Forgot the dB portion;

Set conn = Server.CreateObject("ADODB.Connection")
conn.ConnectionTimeout = 15
conn.CommandTimeout =  10
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("/data/jobs.mdb")
Set rs = Server.CreateObject("ADODB.Recordset")

sql = "SELECT * FROM contacts"
Set rs = conn.Execute(sql)

On Error Resume Next
Do While Not rs.EOF

' All the dB values

fNameStr = rs("First")
strTo = rs("Email")
strFrom = rs("Email")

' Now process the email message and form data
' From above...

' Loop
Response.Write "First Name: " &fName&", Message sent to " & strTo & "<br>"


' Clean up
Set rs = Nothing
Set conn = Nothign


Expert Comment

ID: 7040769
Here are 2 form----banner.asp and postbanneremail.asp.
You need only execute the banner.asp....
It can run on window2000 and hope it can help you....

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../scripts/style.css" type="text/css">
<meta name="Author" content="s.j.">

<body bgcolor="#FFFFFF" text="#000000" topmargin="0">
<table width="408" border="0" cellspacing="0" cellpadding="0">
    <td width="2">&nbsp;</td>
    <td width="404">
      <table width="404" border="0" cellspacing="1" cellpadding="1">
          <td bgcolor="#66CCFF">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCCC" bordercolor="#CCCCCC">
              <form name="form3" method="post" action="postbanneremail.asp">
                <tr bgcolor="#33CCFF">
                  <td width="1%" bgcolor="#FFFFFF">&nbsp;</td>
                  <td colspan="3" bgcolor="#FFFFFF"><font face="Verdana" size="-3" color="#FF0000">*<b>
                    <font size="-4">Require Information</font></b></font></td>
                <tr bgcolor="#33CCFF">
                  <td width="1%" bgcolor="#FFFFFF"><font face="Verdana" size="-3" color="#FF0000">*</font></td>
                  <td width="49%" bgcolor="#FFFFFF"><b><font face="Verdana" size="-2">Contact
                    Person :</font></b></td>
                  <td colspan="2" bgcolor="#FFFFFF">
                    <input type="text" name="contactperson">
                <tr bgcolor="#33CCFF">
                  <td width="1%" bgcolor="#FFFFFF"><font face="Verdana" size="-3" color="#FF0000">*</font></td>
                  <td width="49%" bgcolor="#FFFFFF"><b><font face="Verdana" size="-2">Address
                  <td colspan="2" bgcolor="#FFFFFF">
                    <textarea name="address"></textarea>
                <tr bgcolor="#33CCFF">
                  <td width="1%" bgcolor="#FFFFFF"><font face="Verdana" size="-3" color="#FF0000">*</font></td>
                  <td width="49%" bgcolor="#FFFFFF"><b><font face="Verdana" size="-2">City
                  <td colspan="2" bgcolor="#FFFFFF">
                    <input type="text" name="city">
                <tr bgcolor="#33CCFF">
                  <td width="1%" bgcolor="#FFFFFF">&nbsp;</td>
                  <td width="49%" bgcolor="#FFFFFF"><b><font face="Verdana" size="-2">Post
                    Code :</font></b></td>
                  <td colspan="2" bgcolor="#FFFFFF">
                    <input type="text" name="postcode">
                <tr bgcolor="#33CCFF">
                  <td width="1%" bgcolor="#FFFFFF">&nbsp;</td>
                  <td width="49%" bgcolor="#FFFFFF"><b><font face="Verdana" size="-2">State
                  <td colspan="2" bgcolor="#FFFFFF">
                    <select name=state>
                      <option value="" selected>Select a State </option>
                      <option value="">----------------------------- </option>
                      <option value="Johor ">Johor </option>
                      <option value="Kedah ">Kedah </option>
                      <option value="Kelantan ">Kelantan </option>
                      <option value="Kuala Lumpur ">Kuala Lumpur </option>
                      <option value="Melaka ">Melaka </option>
                      <option value="Negeri Sembilan ">Negeri Sembilan </option>
                      <option value="Pahang ">Pahang </option>
                      <option value="Perak ">Perak </option>
                      <option value="Perlis ">Perlis </option>
                      <option value="Pulau Pinang ">Pulau Pinang </option>
                      <option value="Sabah ">Sabah </option>
                      <option value="Sarawak ">Sarawak </option>
                      <option value="Selangor ">Selangor </option>
                      <option value="Terengganu ">Terengganu </option>
                      <option value="Others">Others</option>
                <tr bgcolor="#33CCFF">
                  <td width="1%" bgcolor="#FFFFFF">&nbsp;</td>
                  <td width="49%" bgcolor="#FFFFFF"><b><font face="Verdana" size="-2">Country
                  <td colspan="2" bgcolor="#FFFFFF">
                    <select name=country>
                      <option value="">Select a Country </option>
                      <option value="">----------------------------- </option>
                      <option value="Afghanistan ">Afghanistan </option>
                      <option value="Albania ">Albania </option>
                      <option value="Algeria ">Algeria </option>
                      <option value="American Samoa ">American Samoa </option>
                      <option value="Andorra ">Andorra </option>
                      <option value="Angola ">Angola </option>
                      <option value="Anguilla ">Anguilla </option>
                      <option value="Antarctica ">Antarctica </option>
                      <option value="Antigua and Barbuda ">Antigua and Barbuda
                      <option value="Argentina ">Argentina </option>
                      <option value="Armenia ">Armenia </option>
                      <option value="Aruba ">Aruba </option>
                      <option value="Australia ">Australia </option>
                      <option value="Austria ">Austria </option>
                      <option value="Azerbaijan ">Azerbaijan </option>
                      <option value="Bahamas ">Bahamas </option>
                      <option value="Bahrain ">Bahrain </option>
                      <option value="Bangladesh ">Bangladesh </option>
                      <option value="Barbados ">Barbados </option>
                      <option value="Belarus ">Belarus </option>
                      <option value="Belgium ">Belgium </option>
                      <option value="Belize ">Belize </option>
                      <option value="Benin ">Benin </option>
                      <option value="Bermuda ">Bermuda </option>
                      <option value="Bhutan ">Bhutan </option>
                      <option value="Bolivia ">Bolivia </option>
                      <option value="Bosnia and Herzegovina ">Bosnia and Herzegovina
                      <option value="Botswana ">Botswana </option>
                      <option value="Bouvet Island ">Bouvet Island </option>
                      <option value="Brazil ">Brazil </option>
                      <option value="British Indian Ocean Territory ">British
                      Indian Ocean Territory </option>
                      <option value="Brunei Darussalam ">Brunei Darussalam </option>
                      <option value="Bulgaria ">Bulgaria </option>
                      <option value="Burkina Faso ">Burkina Faso </option>
                      <option value="Burundi ">Burundi </option>
                      <option value="Cambodia ">Cambodia </option>
                      <option value="Cameroon ">Cameroon </option>
                      <option value="Canada ">Canada </option>
                      <option value="Cape Verde ">Cape Verde </option>
                      <option value="Cayman Islands ">Cayman Islands </option>
                      <option value="Central African Republic ">Central African
                      Republic </option>
                      <option value="Chad ">Chad </option>
                      <option value="Chile ">Chile </option>
                      <option value="China ">China </option>
                      <option value="Christmas Island ">Christmas Island </option>
                      <option value="Cocos [Keeling] Islands ">Cocos [Keeling]
                      Islands </option>
                      <option value="Colombia ">Colombia </option>
                      <option value="Comoros ">Comoros </option>
                      <option value="Congo ">Congo </option>
                      <option value="Cook Islands ">Cook Islands </option>
                      <option value="Costa Rica ">Costa Rica </option>
                      <option value="Cote D'Ivoire [Ivory Coast] ">Cote D'Ivoire
                      [Ivory Coast] </option>
                      <option value="Croatia [Hrvatska] ">Croatia [Hrvatska] </option>
                      <option value="Cuba ">Cuba </option>
                      <option value="Cyprus ">Cyprus </option>
                      <option value="Czech Republic ">Czech Republic </option>
                      <option value="Denmark ">Denmark </option>
                      <option value="Djibouti ">Djibouti </option>
                      <option value="Dominica ">Dominica </option>
                      <option value="Dominican Republic ">Dominican Republic </option>
                      <option value="East Timor ">East Timor </option>
                      <option value="Ecuador ">Ecuador </option>
                      <option value="Egypt ">Egypt </option>
                      <option value="El Salvador ">El Salvador </option>
                      <option value="Equatorial Guinea ">Equatorial Guinea </option>
                      <option value="Eritrea ">Eritrea </option>
                      <option value="Estonia ">Estonia </option>
                      <option value="Ethiopia ">Ethiopia </option>
                      <option value="Falkland Islands [Malvinas] ">Falkland Islands
                      [Malvinas] </option>
                      <option value="Faroe Islands ">Faroe Islands </option>
                      <option value="Fiji ">Fiji </option>
                      <option value="Finland ">Finland </option>
                      <option value="France ">France </option>
                      <option value="France, Metropolitan ">France, Metropolitan
                      <option value="French Guiana ">French Guiana </option>
                      <option value="French Polynesia ">French Polynesia </option>
                      <option value="French Southern Territories ">French Southern
                      Territories </option>
                      <option value="Gabon ">Gabon </option>
                      <option value="Gambia ">Gambia </option>
                      <option value="Georgia ">Georgia </option>
                      <option value="Germany ">Germany </option>
                      <option value="Ghana ">Ghana </option>
                      <option value="Gibraltar ">Gibraltar </option>
                      <option value="Greece ">Greece </option>
                      <option value="Greenland ">Greenland </option>
                      <option value="Grenada ">Grenada </option>
                      <option value="Guadeloupe ">Guadeloupe </option>
                      <option value="Guam ">Guam </option>
                      <option value="Guatemala ">Guatemala </option>
                      <option value="Guinea ">Guinea </option>
                      <option value="Guinea-Bissau ">Guinea-Bissau </option>
                      <option value="Guyana ">Guyana </option>
                      <option value="Haiti ">Haiti </option>
                      <option value="Heard and McDonald Islands ">Heard and McDonald
                      Islands </option>
                      <option value="Honduras ">Honduras </option>
                      <option value="Hong Kong ">Hong Kong </option>
                      <option value="Hungary ">Hungary </option>
                      <option value="Iceland ">Iceland </option>
                      <option value="India ">India </option>
                      <option value="Indonesia ">Indonesia </option>
                      <option value="Iran ">Iran </option>
                      <option value="Iraq ">Iraq </option>
                      <option value="Ireland ">Ireland </option>
                      <option value="Israel ">Israel </option>
                      <option value="Italy ">Italy </option>
                      <option value="Jamaica ">Jamaica </option>
                      <option value="Japan ">Japan </option>
                      <option value="Jordan ">Jordan </option>
                      <option value="Kazakhstan ">Kazakhstan </option>
                      <option value="Kenya ">Kenya </option>
                      <option value="Kiribati ">Kiribati </option>
                      <option value="Korea [North] ">Korea [North] </option>
                      <option value="Korea [South] ">Korea [South] </option>
                      <option value="Kuwait ">Kuwait </option>
                      <option value="Kyrgyzstan ">Kyrgyzstan </option>
                      <option value="Laos ">Laos </option>
                      <option value="Latvia ">Latvia </option>
                      <option value="Lebanon ">Lebanon </option>
                      <option value="Lesotho ">Lesotho </option>
                      <option value="Liberia ">Liberia </option>
                      <option value="Libya ">Libya </option>
                      <option value="Liechtenstein ">Liechtenstein </option>
                      <option value="Lithuania ">Lithuania </option>
                      <option value="Luxembourg ">Luxembourg </option>
                      <option value="Macau ">Macau </option>
                      <option value="Macedonia ">Macedonia </option>
                      <option value="Madagascar ">Madagascar </option>
                      <option value="Malawi ">Malawi </option>
                      <option value="Malaysia " selected>Malaysia </option>
                      <option value="Maldives ">Maldives </option>
                      <option value="Mali ">Mali </option>
                      <option value="Malta ">Malta </option>
                      <option value="Marshall Islands ">Marshall Islands </option>
                      <option value="Martinique ">Martinique </option>
                      <option value="Mauritania ">Mauritania </option>
                      <option value="Mauritius ">Mauritius </option>
                      <option value="Mayotte ">Mayotte </option>
                      <option value="Mexico ">Mexico </option>
                      <option value="Micronesia ">Micronesia </option>
                      <option value="Moldova ">Moldova </option>
                      <option value="Monaco ">Monaco </option>
                      <option value="Mongolia ">Mongolia </option>
                      <option value="Montserrat ">Montserrat </option>
                      <option value="Morocco ">Morocco </option>
                      <option value="Mozambique ">Mozambique </option>
                      <option value="Myanmar ">Myanmar </option>
                      <option value="Namibia ">Namibia </option>
                      <option value="Nauru ">Nauru </option>
                      <option value="Nepal ">Nepal </option>
                      <option value="Netherlands ">Netherlands </option>
                      <option value="Netherlands Antilles ">Netherlands Antilles
                      <option value="New Caledonia ">New Caledonia </option>
                      <option value="New Zealand ">New Zealand </option>
                      <option value="Nicaragua ">Nicaragua </option>
                      <option value="Niger ">Niger </option>
                      <option value="Nigeria ">Nigeria </option>
                      <option value="Niue ">Niue </option>
                      <option value="Norfolk Island ">Norfolk Island </option>
                      <option value="Northern Mariana Islands ">Northern Mariana
                      Islands </option>
                      <option value="Norway ">Norway </option>
                      <option value="Oman ">Oman </option>
                      <option value="Pakistan ">Pakistan </option>
                      <option value="Palau ">Palau </option>
                      <option value="Panama ">Panama </option>
                      <option value="Papua New Guinea ">Papua New Guinea </option>
                      <option value="Paraguay ">Paraguay </option>
                      <option value="Peru ">Peru </option>
                      <option value="Philippines ">Philippines </option>
                      <option value="Pitcairn ">Pitcairn </option>
                      <option value="Poland ">Poland </option>
                      <option value="Portugal ">Portugal </option>
                      <option value="Puerto Rico ">Puerto Rico </option>
                      <option value="Qatar ">Qatar </option>
                      <option value="Reunion ">Reunion </option>
                      <option value="Romania ">Romania </option>
                      <option value="Russian Federation ">Russian Federation </option>
                      <option value="Rwanda ">Rwanda </option>
                      <option value="S. Georgia and S. Sandwich Islands ">S. Georgia
                      and S. Sandwich Islands </option>
                      <option value="Saint Kitts and Nevis ">Saint Kitts and Nevis
                      <option value="Saint Lucia ">Saint Lucia </option>
                      <option value="Saint Vincent and The Grenadines ">Saint
                      Vincent and The Grenadines </option>
                      <option value="Samoa ">Samoa </option>
                      <option value="San Marino ">San Marino </option>
                      <option value="Sao Tome and Principe ">Sao Tome and Principe
                      <option value="Saudi Arabia ">Saudi Arabia </option>
                      <option value="Senegal ">Senegal </option>
                      <option value="Seychelles ">Seychelles </option>
                      <option value="Sierra Leone ">Sierra Leone </option>
                      <option value="Singapore ">Singapore </option>
                      <option value="Slovak Republic ">Slovak Republic </option>
                      <option value="Slovenia ">Slovenia </option>
                      <option value="Solomon Islands ">Solomon Islands </option>
                      <option value="Somalia ">Somalia </option>
                      <option value="South Africa ">South Africa </option>
                      <option value="Spain ">Spain </option>
                      <option value="Sri Lanka ">Sri Lanka </option>
                      <option value="St. Helena ">St. Helena </option>
                      <option value="St. Pierre and Miquelon ">St. Pierre and
                      Miquelon </option>
                      <option value="Sudan ">Sudan </option>
                      <option value="Suriname ">Suriname </option>
                      <option value="Svalbard and Jan Mayen Islands ">Svalbard
                      and Jan Mayen Islands </option>
                      <option value="Swaziland ">Swaziland </option>
                      <option value="Sweden ">Sweden </option>
                      <option value="Switzerland ">Switzerland </option>
                      <option value="Syria ">Syria </option>
                      <option value="Taiwan ">Taiwan </option>
                      <option value="Tajikistan ">Tajikistan </option>
                      <option value="Tanzania ">Tanzania </option>
                      <option value="Thailand ">Thailand </option>
                      <option value="Togo ">Togo </option>
                      <option value="Tokelau ">Tokelau </option>
                      <option value="Tonga ">Tonga </option>
                      <option value="Trinidad and Tobago ">Trinidad and Tobago
                      <option value="Tunisia ">Tunisia </option>
                      <option value="Turkey ">Turkey </option>
                      <option value="Turkmenistan ">Turkmenistan </option>
                      <option value="Turks and Caicos Islands ">Turks and Caicos
                      Islands </option>
                      <option value="Tuvalu ">Tuvalu </option>
                      <option value="Uganda ">Uganda </option>
                      <option value="Ukraine ">Ukraine </option>
                      <option value="United Arab Emirates ">United Arab Emirates
                      <option value="United Kingdom ">United Kingdom </option>
                      <option value="United States Of America ">United States
                      Of America </option>
                      <option value="Uruguay ">Uruguay </option>
                      <option value="US Minor Outlying Islands ">US Minor Outlying
                      Islands </option>
                      <option value="Uzbekistan ">Uzbekistan </option>
                      <option value="Vanuatu ">Vanuatu </option>
                      <option value="Vatican City State [Holy See] ">Vatican City
                      State [Holy See] </option>
                      <option value="Venezuela ">Venezuela </option>
                      <option value="Viet Nam ">Viet Nam </option>
                      <option value="Virgin Islands [British] ">Virgin Islands
                      [British] </option>
                      <option value="Virgin Islands [US] ">Virgin Islands [US]
                      <option value="Wallis and Futuna Islands ">Wallis and Futuna
                      Islands </option>
                      <option value="Western Sahara ">Western Sahara </option>
                      <option value="Yemen ">Yemen </option>
                      <option value="Yugoslavia ">Yugoslavia </option>
                      <option value="Zaire ">Zaire </option>
                      <option value="Zambia">Zambia</option>
                <tr bgcolor="#33CCFF">
                  <td width="1%" bgcolor="#FFFFFF"><font face="Verdana" size="-3" color="#FF0000">*</font></td>
                  <td width="49%" bgcolor="#FFFFFF"><b><font face="Verdana" size="-2">Email
                  <td colspan="2" bgcolor="#FFFFFF">
                    <input type="text" name="email">
                <tr bgcolor="#33CCFF">
                  <td width="1%" bgcolor="#FFFFFF"><font face="Verdana" size="-3" color="#FF0000">*</font></td>
                  <td width="49%" bgcolor="#FFFFFF"><b><font face="Verdana" size="-2">Telephone
                  <td colspan="2" bgcolor="#FFFFFF">
                    <input type="text" name="telephone">
                <tr bgcolor="#33CCFF">
                  <td width="1%" bgcolor="#FFFFFF">&nbsp;</td>
                  <td width="49%" bgcolor="#FFFFFF"><b><font face="Verdana" size="-2">Mobile
                    Phone :</font></b></td>
                  <td colspan="2" bgcolor="#FFFFFF">
                    <input type="text" name="mobilephone">
                <tr bgcolor="#33CCFF">
                  <td width="1%" bgcolor="#FFFFFF">&nbsp;</td>
                  <td width="49%" bgcolor="#FFFFFF"><b></b></td>
                  <td width="11%" bgcolor="#FFFFFF">&nbsp; </td>
                  <td width="39%" bgcolor="#FFFFFF">
                    <input type="submit" name="Submit2" value="Submit">
    <td width="2">&nbsp;</td>


Response.Buffer = True

      'Dimension variables
      Dim strBody                   'Holds the body of the e-mail
      Dim objCDOMail                   'Holds the mail server object
      Dim strMyEmailAddress             'Holds your e-mail address
      Dim strCCEmailAddress            'Holds any carbon copy e-mail addresses if you want to send carbon copies of the e-mail
      Dim strBCCEmailAddress            'Holds any blind copy e-mail addresses if you wish to send blind copies of the e-mail
      Dim strReturnEmailAddress      'Holds the return e-mail address of the user
      '----------------- Place your e-mail address in the following sting ----------------------------------
      strMyEmailAddress = "abcdefg@email.com"

      strCCEmailAddress = "" 

      strBCCEmailAddress = "" 

      'Read in the users e-mail address
      strReturnEmailAddress = Request.Form("email")

      'Initialse strBody string with the body of the e-mail
      strBody = "<h2>Requesting for posting banner in ePASAR's Friend Corner</h2>"
      strBody = strBody & "--------------------------------------------------------------------------------------------"

      strBody = strBody & "<br><b>Name: </b>" & Request.Form("contactperson")

      If (Request.Form("address")) > "" Then
            strBody = strBody & "<br><br><b>Address                        : </b>" & Request.Form("address")
      End If
      If (Request.Form("city")) > "--- Choose One ---" Then
            strBody = strBody & "<br><br><b>City                                    : </b>" & Request.Form("city")
      End IF
      If (Request.Form("postcode")) > "" Then
            strBody = strBody & "<br><br><b>Post Code                              : </b>" & Request.Form("postcode")
      End If
      If (Request.Form("state")) > "" Then
            strBody = strBody & "<br><br><b>State                                    : </b>" & Request.Form("state")
      End If
      If (Request.Form("country")) > "" Then
            strBody = strBody & "<br><br><b>Country                                    : </b>" & Request.Form("country")
      End If
      If (Request.Form("email")) > "" Then
            strBody = strBody & "<br><br><b>Email                                    : </b>" & Request.Form("email")
      End If
      If (Request.Form("telephone")) > "" Then
            strBody = strBody & "<br><br><b>Telephone                              : </b>" & Request.Form("telephone")
      End If
      If (Request.Form("mobilephone")) > "" Then
            strBody = strBody & "<br><br><b>Mobile Phone                        : </b>" & Request.Form("mobilephone")
      End If

      'Check to see if the user has entered an e-mail address and that it is a valid address otherwise set the e-mail address to your own otherwise the e-mail will be rejected
      If Len(strReturnEmailAddress) < 5 OR NOT Instr(1, strReturnEmailAddress, " ") = 0 OR InStr(1, strReturnEmailAddress, "@", 1) < 2 OR InStrRev(strReturnEmailAddress, ".") < InStr(1, strReturnEmailAddress, "@", 1) Then
            'Set the return e-mail address to your own
            strReturnEmailAddress = strMyEmailAddress
      End If      

      'Send the e-mail

      'Create the e-mail server object
      Set objCDOMail = Server.CreateObject("CDONTS.NewMail")

      'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent)
      objCDOMail.From = Request.Form("contactperson") & " from " & Request.Form("companyname") & " <" & strReturnEmailAddress & ">"

      'Who the e-mail is sent to
      objCDOMail.To = strMyEmailAddress

      'Who the carbon copies are sent to
      objCDOMail.Cc = strCCEmailAddress

      'Who the blind copies are sent to
      objCDOMail.Bcc = strBCCEmailAddress

      'Set the subject of the e-mail
      objCDOMail.Subject = "Requesting for posting banner in ePASAR's Friend Corner"

      'Set the e-mail body format (0=HTML 1=Text)
      objCDOMail.BodyFormat = 0

      'Set the mail format (0=MIME 1=Text)
      objCDOMail.MailFormat = 0

      'Set the main body of the e-mail
      objCDOMail.Body = strBody

      'Importance of the e-mail (0=Low, 1=Normal, 2=High)
      objCDOMail.Importance = 1

      'Send the e-mail
      'Close the server object
      Set objCDOMail = Nothing
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<title>Contact Us</title>
<meta name="Author" content="s.j.">
<body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#990099" alink="#FF0000">
<table width="85%" border="0" align="center" cellpadding="0" cellspacing="0">
    <td align="center"> Thank-you <% = Request.Form("contactperson") %> from <% = Request.Form("country") %> for filling in the enquiry form.
    I shall be receiving your enquiry shortly and will reply as soon as possible.</td>
<div align="center"></div>

Expert Comment

ID: 7040774
This is one of my part of project.....
Hope it can help you.........

Sorry to make your page become longer..........
I am rush of time and no time to delete the unusable code.......

Say sorry again....
LVL 46

Expert Comment

ID: 7040860

How does your code loop through a database of users as the question requests?

Fritz the Blank

Expert Comment

ID: 7040908
Sorry for the comment that i posted............

I misunderstand the question..........Sorry for englishman and thank you for fritz_the_blank to remember me.....

Sorry to you guy one more time......

Author Comment

ID: 7041236
Cheers Fritz and MG - I'll be testing them soon.
LVL 46

Expert Comment

ID: 7041407

No reason to be sorry--I think it's great that your contributing to the thread.

Fritz the Blank

Author Comment

ID: 7086661
Please bear with me - when I have done it I WILL close this question.
LVL 18

Expert Comment

ID: 7090153

Author Comment

ID: 7305171
Cheers, - at last!

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

656 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