<%
Set arrTo = Session("arrTo")
Set arrCc = Session("arrCC")
Set arrBcc = Session("arrBcc")
Set arrFiles = Session("arrFiles")
' Handle "Send Message" button
Mail.Host = "smtp.yourcompany.com"
If Request("SEND") <> "" Then
' get addresses from collections
Items = arrTo.Items
For i = 0 to arrTo.Count - 1
Mail.AddAddress Items(i)
Next
Items = arrCc.Items
For i = 0 to arrCc.Count - 1
Mail.AddCc Items(i)
Next
Items = arrBcc.Items
For i = 0 to arrBcc.Count - 1
Mail.AddBcc Items(i)
Next
Items = arrFiles.Items
For i = 0 to arrFiles.Count - 1
Mail.AddAttachment Items(i)
Next
Mail.From = "jsmith@persits.com"
Mail.FromName = "John Smith"
Mail.Subject = Request("Subject")
Mail.Body = Request("Body")
On Error Resume Next
if not Mail.Send Then
ErrStr = Err.Description
Else
arrTo.RemoveAll
arrCc.RemoveAll
arrBcc.RemoveAll
arrFiles.RemoveAll
End If
On Error Goto 0
End If
' Handle "Add Address" buttons
Session("Count") = Session("Count") + 1
If Request("Address") <> "" Then arrTo.Add Session("Count"), CStr(Request("Address"))
If Request("CCAddress") <> "" Then arrCc.Add Session("Count"), CStr(Request("CCAddress"))
If Request("BccAddress") <> "" Then arrBcc.Add Session("Count"), CStr(Request("BccAddress"))
' Handle Delete command
If Request("DeleteTo") <> "" Then arrTo.Remove CInt(Request("DeleteTo"))
If Request("DeleteCc") <> "" Then arrCc.Remove CInt(Request("DeleteCc"))
If Request("DeleteBcc") <> "" Then arrBcc.Remove CInt(Request("DeleteBcc"))
%>
Persits Software AspEmail Demo
Attachments:
<%
For i = 0 to arrFiles.Count - 1
Keys = arrFiles.Keys
Items = arrFiles.Items
Response.Write Items(i) & "; "
Next
%>