codice:
<%@ Language=VBScript %>
<%
Set Con = Server.CreateObject( "ADODB.Connection" )
Con.Open "accessDSN"
'estrai gli indirizzi email dalla tabella newsletter e clienti
sqlString = "SELECT user_email, newsletter_email " &_
"FROM Users, newsletter WHERE Users.user_email<>newsletter.newsletter_email"
SET RS = Con.Execute( sqlString )
if not RS.EOF then
do while not RS.EOF
email = RS( "user_email" ) & ";" & RS( "newsletter_email" )
' invia la newsletter
Dim objMail
Set objMail = CreateObject("CDONTS.NewMail")
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<title>Newsletter</title>"
HTML = HTML & "</head>"
HTML = HTML & "<body bgcolor=""white"">"
HTML = HTML & "Questa è la newletter.
"
HTML = HTML & "Questa è la newletter.
"
HTML = HTML & "Prova"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
objMail.From = "newletter@prova.com"
objMail.To = email
objMail.Subject = "Newsletter prova"
objMail.BodyFormat = 0
objMail.MailFormat = 0
objMail.Body = HTML
objMail.Send
RS.MOVENext
Loop
end if
RS.Close
Set RS=nothing
Con.Close
set Con=nothing
%>
<HTML>
<HEAD>
</HEAD>
<BODY>
Le newsletter sono state spedite!</P>
</BODY>
</HTML>
Roby