hi there. Im sorry I have not got time to write your code for you which seems to be what you are asking. FYI to get the best out of fourms you should always have a go, come to an issue and post the issues as they come up....
But what I have got is a little bit of code I used to send a bulk mal out fo everyone in a contacts table. Im sure you could:
> place your connection string at the top (myn is in a global file....)
> replace my query with oone that asks your DB/table for info
> replace my 'mailIP' variable with your SMTP IP address. (myn is in a global file....)
> Then replace the email content from the '.To' line
> after posting I also realised I left in the 'if mailEnabled' line in. this is also a global setting I use. Get rid of this and its 'else' 'end if'. Or add this:
Dim MailEnabled
MailEnabled - true
The code will work for you. Based on making the above changes it will work for you.
Code:
<% OPTION EXPLICIT %>
<% Dim iMsg,iConf,Flds,strHTML,strSmartHost
sql = "Select cName,cPhone,cEmail,cMessage,dateEntered from contactPage order by ID;"
set getInfo = conn.execute(sql)
if not getInfo.eof then
if MailEnabled then
Const cdoSendUsingPort = 2
StrSmartHost = mailIP
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Update
End With
do until getInfo.eof
With iMsg
Set .Configuration = iConf
.To = getInfo(2)
.From = "info@elitemarquees.com.au"
.Subject = "Mail for " & getInfo(0) & " from Elite Marquees"
.HTMLBody = "<table border='0' align='center' width='600'>" & _
"<tr><td>" & getInfo(1) & "</td></tr>" & _
"<tr><td><br><bR>Afternoon - we hope you are having a great day! You have received this message because you have contacted Elite Marquees using our contacts page at www.elitemarquees.com.au. Elite Marquees have recently joined the Facebook community and would like to invite you to visit our page to comment about your experiences with us. Our page can be found at:</td></tr>" & _
"<tr><td><br><br><a href='http://www.facebook.com/EliteMarquees' title='Click to visit Elite Marquees Facebook Page'>www.facebook.com/EliteMarquees</a></td></tr>" & _
"<tr><td><br><bR>Or if you could simply ‘LIKE’ us by clicking the ‘LIKE’ button which can be found towards the bottom of any page on our website:</td></tr>" & _
"<tr><td><br><br><a href='http://www.elitemarquees.com.au' title='Click to visit Elite Marquees website'>www.elitemarquees.com.au</a></td></tr>" & _
"<tR><td><bR><br>Please accept my apologies if this email has inconvenienced you in any way. As a reminder the initial enquiry you sent us was recieved on " & getInfo(4) & " </td></tr>" & _
"<tr><td><br>Kind Regards<br>Matthew Burr<br>Elite Marquees<bR>W - <a href='http://www.elitemarquees.com.au' title='Click to visit Elite Marquees web site'>www.elitemarquees.com.au</a><bR>T - 0424 101 130</td></tr>" & _
"</table>"
.Send
End With
response.write "Mail sent to " & getInfo(0) & " (" & getInfo(2) & ")<br>"
getInfo.moveNext
loop
else
response.write "mail is disabled"
end if
else
response.write "no records found"
end if
conn.close
set conn= nothing %>