Ver Mensaje Individual
  #7 (permalink)  
Antiguo 14/04/2002, 14:13
Avatar de el_cesar
el_cesar
 
Fecha de Ingreso: mayo-2001
Ubicación: Cali
Mensajes: 2.423
Antigüedad: 24 años
Puntos: 20
Re: Mail Personalizado!!!

<%
' change to address of your own SMTP server
strHost = "mail.atlantech.net"
%>

<HEAD>
<TITLE>AspEmail: Database.asp</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H2>AspEmail: Database.asp</h2>
<h3>Demonstrates sending a message to multiple recipients<BR>whose names and addresses
are stored in a database.</h3>

<%
' connect to the MS Access database in the same directory
strDbPath = Server.MapPath(".") & "\users.mdb"
ConnectStr = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & strDbPath

Set rs = Server.CreateObject("adodb.recordset")
rs.Open "users", ConnectStr, 2, 3

If Request("Send") <> "" Then
' send email to all users
Set Mail = Server.CreateObject("Persits.MailSender" )
Mail.Host = mail.cuao.edu.co

Mail.From = "[email protected]"
Mail.FromName = "Cesar Augusto Jaramillo"
Mail.Subject = Request("Subject")
Mail.Body = Request("Body")

' read address from DB and put them in the BCC field
While not rs.EOF
Mail.AddBcc rs("email"), rs("name")
rs.MoveNext
Wend

' finally: send message
Mail.Send

Response.Write "Success!"
Else
' simply display the list of users in the database
Response.Write "<B>Currently in the user database:</B><P>"
While not rs.EOF
Response.Write rs("name") & " (" & rs("email") & ")<BR>"
rs.MoveNext
Wend
End If
%>

<FORM ACTION="Database.asp">

Body: <TEXTAREA NAME="Body"></TEXTAREA><BR>
<INPUT TYPE=SUBMIT NAME="Send" VALUE="Send a message to them all">
</FORM>

</BODY>
</HTML>