Solved

cdonts example

Posted on 2002-05-28
13
218 Views
Last Modified: 2010-05-18
Hi,

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
0
Comment
Question by:englishman
  • 4
  • 3
  • 3
  • +1
13 Comments
 
LVL 46

Expert Comment

by:fritz_the_blank
Comment Utility
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
     objMail.Send
     objRSStaff.MoveNext
loop

Set objMail = Nothing
%>
0
 
LVL 46

Expert Comment

by:fritz_the_blank
Comment Utility
I forgot to close the recordset and connection objects and then set them to nothing.

Fritz the Blank
0
 
LVL 18

Accepted Solution

by:
mgfranz earned 100 total points
Comment Utility
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."
Else
     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!
objCDO.Send
Set objCDO = Nothing
%>

Pretty simple really... ;-)
0
 
LVL 18

Expert Comment

by:mgfranz
Comment Utility
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
rs.MoveFirst
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>"

rs.MoveNext
loop

' Clean up
Set rs = Nothing
rs.Close
Set conn = Nothign
conn.Close

%>
0
 
LVL 1

Expert Comment

by:paradise45
Comment Utility
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....


banner.asp
============
<html>
<head>
<title></title>
<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.">
</head>

<body bgcolor="#FFFFFF" text="#000000" topmargin="0">
<table width="408" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="2">&nbsp;</td>
    <td width="404">
      <table width="404" border="0" cellspacing="1" cellpadding="1">
        <tr>
          <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>
                <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">
                  </td>
                </tr>
                <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
                    :</font></b></td>
                  <td colspan="2" bgcolor="#FFFFFF">
                    <textarea name="address"></textarea>
                  </td>
                </tr>
                <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
                    :</font></b></td>
                  <td colspan="2" bgcolor="#FFFFFF">
                    <input type="text" name="city">
                  </td>
                </tr>
                <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">
                  </td>
                </tr>
                <tr bgcolor="#33CCFF">
                  <td width="1%" bgcolor="#FFFFFF">&nbsp;</td>
                  <td width="49%" bgcolor="#FFFFFF"><b><font face="Verdana" size="-2">State
                    :</font></b></td>
                  <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>
                    </select>
                  </td>
                </tr>
                <tr bgcolor="#33CCFF">
                  <td width="1%" bgcolor="#FFFFFF">&nbsp;</td>
                  <td width="49%" bgcolor="#FFFFFF"><b><font face="Verdana" size="-2">Country
                    :</font></b></td>
                  <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>
                      <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>
                      <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>
                      <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>
                      <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>
                      <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>
                      <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>
                      <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>
                      <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>
                      <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>
                    </select>
                  </td>
                </tr>
                <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
                    :</font></b></td>
                  <td colspan="2" bgcolor="#FFFFFF">
                    <input type="text" name="email">
                  </td>
                </tr>
                <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
                    :</font></b></td>
                  <td colspan="2" bgcolor="#FFFFFF">
                    <input type="text" name="telephone">
                  </td>
                </tr>
                <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">
                  </td>
                </tr>
                <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>
                </tr>
              </form>
            </table>
          </td>
        </tr>
      </table>
    </td>
    <td width="2">&nbsp;</td>
  </tr>
</table>
</body>
</html>

postbanneremail.asp
===========================

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

Expert Comment

by:paradise45
Comment Utility
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....
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 46

Expert Comment

by:fritz_the_blank
Comment Utility
Paradise45,

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

Fritz the Blank
0
 
LVL 1

Expert Comment

by:paradise45
Comment Utility
ooh!
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......
q(^o^)p
0
 
LVL 2

Author Comment

by:englishman
Comment Utility
Cheers Fritz and MG - I'll be testing them soon.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
Comment Utility
Paradise45,

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

Fritz the Blank
0
 
LVL 2

Author Comment

by:englishman
Comment Utility
Please bear with me - when I have done it I WILL close this question.
Cheers
0
 
LVL 18

Expert Comment

by:mgfranz
Comment Utility
k.
0
 
LVL 2

Author Comment

by:englishman
Comment Utility
Cheers, - at last!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

728 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

10 Experts available now in Live!

Get 1:1 Help Now