Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How could I use asp to send an email .

Status
Not open for further replies.

campbemr

Technical User
Aug 16, 2001
19
US
How would I use asp to send an email to every person who signs up for a mailing list that I have posted on my website.
 
Check this ------- it might help

<html>
...
<%
if request.form(&quot;submit.x&quot;) > 0 then
dim rs, sql, from, to, subject, letter, conn, cs
from = request.form(&quot;from&quot;)
to = &quot;&quot;
subject = request.form(&quot;subject&quot;)
letter = request.form(&quot;letter&quot;)
set conn = server.createobject(&quot;adodb.connection&quot;)
cs = &quot;Provider.............data source=........&quot;
conn.Open(cs)
sql = &quot;SELECT email FROM newsletter db;&quot;
set rs = server.createobject(&quot;adodb.recordset&quot;)
rs.Open sql, conn, adOpenForwardOnly, adLockPessimistic
if not rs.EOF then
while not rs.EOF
to = to & rs(&quot;email&quot;) & &quot;; &quot;
rs.MoveNext
wend
else
response.write &quot;<scipt language=&quot;&quot;javascript&quot;&quot; type=&quot;&quot;text/javascript&quot;&quot;>alert('There is no one on your list!');</script>&quot;&quot;
end if
rs.close
set rs = nothing
conn.close
set conn = nothing
dim mail
set mail = server.createobject(&quot;CDONTS.NewMail&quot;)
with mail
.from = from
.to = to
.subject = subject
.body = body
.send()
mail.close
set mail = nothing
response.redirect &quot;conf.asp&quot;
end if
%>

<body>
<form action=&quot;THISFILENAME.asp&quot; method=&quot;post&quot;>
<input type=&quot;text&quot; name=&quot;from&quot;>
<input type=&quot;text&quot; name=&quot;subject&quot;>
<textarea name=&quot;letter&quot;></textarea>
<input type=&quot;image&quot; src=&quot;img.gif&quot; name=&quot;submit&quot;>
</form>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top