Here's a snippet of code I've used for putting users' e-mail addresses
into a comma separated string.
' *** Build strUserEmails - E-mail addresses separated by comma and
space.
' Set sql.
strSQL = "SELECT UserEmail "
strSQL = strSQL & "FROM tblUser "
strSQL = strSQL & "WHERE (1=1) "
strSQL = strSQL & " AND ( "
' EquipUser level user shown in EquipEvent.EquipEventUserID if there
is one.
If EquipEventUserID <> "" Then
strSQL = strSQL & "( "
strSQL = strSQL & "(UserLevel=" & Chr(39) & "EquipUser" & Chr(39) &
") "
strSQL = strSQL & " AND (UserID=" & Chr(39) &
jpsvbFixSQL(EquipEventUserID) & Chr(39) & ") "
strSQL = strSQL & ") "
End If
' EquipAdmin level users.
strSQL = strSQL & " OR (UserLevel=" & Chr(39) & "EquipAdmin" &
Chr(39) & ") "
' Admin level users.
strSQL = strSQL & " OR (UserLevel=" & Chr(39) & "Admin" & Chr(39) &
") "
strSQL = strSQL & ") "
strSQL = strSQL & " AND (UserEmail Is Not Null) "
strSQL = strSQL & " AND (UserIsEmailNotif=True) "
strSQL = strSQL & "ORDER BY UserLName, UserFName "
' Open rs.
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, objConn
' If no recs.
If objRS.EOF Then
' Close rs.
objRS.Close
Set objRS = Nothing
Exit Function
Else
' Put recs into array for speed.
arrayRS = objRS.GetRows
' Close rs.
objRS.Close
Set objRS = Nothing
' Init.
strUserEmails = ""
' Loop thru rows (i.e. recs).
For I = 0 To UBound(arrayRS, 2)
' Set var using each fld's col num.
UserEmail = jpsvbNullToBlank(arrayRS(0, I))
strUserEmails = strUserEmails & ", " & UserEmail
Next
' Remove initial comma and space.
strUserEmails = Right(strUserEmails, Len(strUserEmails) - 2)
End If
And here's a good reference for sending an e-mail attachment such as a
Word doc (although of course some users' computers might not allow a
Word doc to come through without special consideration since it could
contain macros:
Email (with Attachment)
http://www.asp101.com/samples/email_attach.asp
Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
<<
the author of the newsletter, wants to compil the newsletter in word
from a
remote location and email it to the others, so how do i get that email
to go
to all on the database list