PDA

View Full Version : Web Form with multiple attachments



-=j0nnyr0773n=-
09 Jun 2007, 05:05 PM
I have created a form to send an email with an attachment or 2 if the user so chooses to upload 1 or 2 files to the server. I am using Persits.Upload to upload the files to a upload folder which works fine. Next I am using cdo.message to send my message with the attachment(s). I can send a message but when I add an attachment or 2 it does not send any attachments, I do still get the message. Here is my code, any help would be awesome. Oh and I'd use persits.mailsender but godaddy does not support it :(


<% @LANGUAGE=VBSCRIPT %>



<%
Set Upload = Server.CreateObject("Persits.Upload")

Upload.IgnoreNoPost = True



Upload.SaveVirtual("../upload/")



sch = "http://schemas.microsoft.com/cdo/configuration/"



Set cdoConfig = CreateObject("CDO.Configuration")



With cdoConfig.Fields

.Item(sch & "sendusing") = 2 ' cdoSendUsingPort

.Item(sch & "smtpserver") = "relay-hosting.secureserver.net"

.update

End With



Set cdoMessage = CreateObject("CDO.Message")



With cdoMessage

Set .Configuration = cdoConfig

.From = Upload.form("email")

.To = "email@email.com"

.Subject = "Self Centered Productions Webform Request"

.TextBody = "Name: " & Upload.form("fname") & vbCrLf & "Last Name: " & Upload.form("lname") & vbCrLf & "Company: " & Upload.form("company") & vbCrLf & "Trade: " & Upload.form("Trade") & vbCrLf & "Telephone: " & Upload.form("telephone") & vbCrLf & "Email: " & Upload.form("email") & vbCrLf & "Cell: " & Upload.form("cellphone") & vbCrLf & "Location: " & Upload.form("location") & vbCrLf & "Comments: " & Upload.form("Comments")
.AddAttachment Upload.form("attachment")

.Send



response.redirect "success.htm"

End With



Set cdoMessage = Nothing

Set cdoConfig = Nothing

%>