I usually do forms in PHP but a client has an ASP site and needs to have forms with file attachments. I was wondering if anyone could help me out. Everything works just fine except that the files won't send. Here is the code that sends in ASP and thank you. <!-- ASP Mail Send Page --> <% Dim bodyText, order, client, info client = "Thank you for contacting us." order = "An order has been placed." Info = "Contact Info" & Chr(13) & Chr(13) & "Name: " & Request.QueryString("name") & Chr(13) & "Position: " & Request.QueryString("position")& Chr(13) & "Company: " & Request.QueryString("compName") & Chr(13) & Chr(13) & "Address: " & Chr(13) & Request.QueryString("Address1") & Chr(13) & Request.QueryString("Address2") & Chr(13) & Chr(13) & "City: " & Request.QueryString("city")& Chr(13) & "Province: " & Request.QueryString("Prov") & Chr(13) & "Country: " & Request.QueryString("Country") & Chr(13) & "Postal Code: " & Request.QueryString("code") & Chr(13) & "E-mail: " & Request.QueryString("email") & Chr(13) & "Phone Number: " & Request.QueryString("Phone_Number") & Chr(13) & "Message: " & Request.QueryString("resume") & Chr(13) Set Mailer = Server.CreateObject("SMTPsvg.Mailer") Mailer.RemoteHost = "smtp.example.com" Mailer.FromName = "www.example.com" Mailer.FromAddress = "test@example.com" Mailer.AddRecipient Request.QueryString("email"),Request.QueryString("email") Mailer.Subject = "Thank you for contacting us!" Mailer.BodyText = Info Mailer.SendMail Set Mailer = Server.CreateObject("SMTPsvg.Mailer") Mailer.RemoteHost = "smtp.example.com" Mailer.FromName = Request.QueryString("Name") Mailer.FromAddress = Request.QueryString("email") Mailer.AddRecipient "me@example.com","me@example.com" Mailer.Subject = "Test Email" Mailer.BodyText = Info Mailer.SendMail %> Code (markup):
Hey nicknick, I can't see anywhere in your code where there is anything to attach a file/document. Though it'll depend on both your mail components capabilities to allow it, plus which one it supports: http://www.tek-tips.com/faqs.cfm?fid=2962 < is a good starting point. Your current code just tries to send 2 emails out. Request.QueryString("email") is checking for something from a previous Form using GET and email as a parameter. EG: sendmail.asp?email=myemail@hotmail.com In your script other things such as position are being added; sendmail.asp?email=myemail@hotmail.com&position=winner
Hi intothemiddle. Thank you for the reply. You're right. There is no info on that page that sends an attachment. I am just not sure how to make it work. I had a look at the page you sent but the whole ASP thing is beyond me. I think I'm going to post in the buy sell trade forum to see if anyone would like to modify that code for $20 or something. Thanks again for the reply.
Hi NickNick, Well I'm happy to help for free by all means, but you need to tell me which component your server supports for email and I'll supply you with something.
<% Set myMail=CreateObject("CDO.Message") myMail.Subject="Sending email with CDO" myMail.From="mymail@mydomain.com" myMail.To="someone@somedomain.com" myMail.TextBody="This is a message." myMail.AddAttachment "c:\mydocuments\test.txt" myMail.Send set myMail=nothing %> Code (markup): w3schools.com/asp/asp_send_email.asp
thanks guys. I ended up hiring someone to get this going for me. They came up with something that uploads a file to the server and then mails and deletes the file. It works very well. thanks again for the replies.
Dear Friend, Can you please share it with me if possible, how did you implemented the feature of sending an attachment with the asp page? Best! Webb
The response posted by RMK above gives an example of a CDO attachment which should meet your requirements or try a component to do so; http://www.aspemail.com/manual_03.html As above, both of these work but will need to be configured (remote hosts, etc) to function properly. Rob