% if Session("fullName") = "" then response.redirect("index.asp")%>
<% Set Mail = Server.CreateObject("Persits.MailSender") Mail.Host = workspaceSMTP ' SMTP server Mail.From = session("email") ' Sender's address Mail.FromName = session("fullname") ' Sender's name Mail.AddAddress session("email") ' For clanking the to field 'let's take the toAddress field and convert it to an array to loop through (IF WE HAVE MORE THAN ONE ADDRESS) Dim addressList addressList = request.form("toAddress") if InStr(1, addressList, ",") > 0 then Dim addressArray addressArray = split(addressList, ",") end if ' Now we loop through our array to get all the relevant addresses if IsArray(addressArray)then For each toAddress in addressArray Mail.AddCC replace(toAddress, " ", "") next else Mail.AddCC request.form("toAddress") end if Mail.AddReplyTo session("email") if request.form("attachment") <> "" then Mail.AddAttachment server.mapPath("attachment") & "\" & request.form("attachment") end if Mail.Subject = request.form("subject") Mail.Body = request.form("messageBody") On Error Resume Next Mail.Send response.write("") If Err <> 0 Then Response.Write "Error encountered: " & Err.Description else Response.Write "Thank you your e-mail has been sent successfully