Create an Email Newsletter... [../dropnav.htm]
Page 4: emailnewshowto4.asp
This page will send your news letter out to your subscribers. It is done completely in HTML view and uses the connection string created by FrontPage when we created our database. This code will loop through your database and send the email from your form on page 3 to your subscribers:

<%

Set objConn = Server.CreateObject("ADODB.Connection")

objConn.Open Application("accessdb_ConnectionString")

Server.ScriptTimeOut = 600

Set rsObj = objConn.Execute ("SELECT emailaddress FROM Results")

Do until RS.EOF

Set Mail = Server.CreateObject("Persits.MailSender")

Mail.Host = "smtp.yourdomain.com" ' Specify a valid SMTP server

Mail.From = "webmaster@frontpagehowto.com" ' Specify sender's address

Mail.FromName = "FrontPageHowTo.com" ' Specify sender's name

Mail.AddAddress rsObj("emailaddress")

Mail.AddReplyTo "webmaster@frontpagehowto.com"

Mail.Subject = "FrontPageHowTo.com Email Newsletter"

Mail.Body = "Hello " & rsObj("emailaddress") & "," &Chr(13) & Chr(10) & Chr(10) & _

Request.Form("News") & _

Chr(10) & Chr(10) & "Please visit our sponsor, paypal.com for a" & _

Chr(10) & "FREE paypal account. Earn $5 for signing up" & _

Chr(10) & "and support this site at the same time! Click here:" & _

Chr(10) & "https://secure.paypal.x.com/affil/pal=bryant%40djwebworks.com" & _

Chr(10) & Chr(10) & _

"To unsubscribe from this newsletter, click the link below:" & Chr(10) & _

"http://www.frontpagehowto.com/newsletter/remove.asp?EmailAddress=" & rsObj("EmailAddress")

On Error Resume Next

Mail.Send

If Err <> 0 Then

Response.Write "Error encountered: " & Err.Description

End If

rsObj.MoveNext

loop

rsObj.Close

objConn.Close

%>

Hint: to paste this code into your page, highlight it, select copy and then right click on your page and select Paste Special and then Treat as HTML.

Note: This method only recommended for smaller mailing lists.

Next Page...

This site was built and is maintained by DJ Web Works.
© 2000. All rights reserved.
Microsoft and FrontPage2000 are registered trade marks of Microsoft Corporation.