Attaching a file to an email asp page

Hi All!

So... I've got a questionnaire form working properly at http://www.hhs1.com/questionnaire.html

I would like to add a field for the user to upload an attachment. That part is easy enough to do in the HTML page.

How can I get the file (resume) to be included in the email that is generated by the asp file? Can it be attached somehow?

Placing ENCTYPE= in the form tag of the HTML page borks up the ASP response page with a CDO error.

The asp code i'm using is seemingly pretty basic. I'm no asp guru, so I'm pretty much stuck here.

the code is as follows:

<%



q1= Request("q1")
q2= Request("q2")
q3= Request("q3")
q4= Request("q4")
q5= Request("q5")
q6= Request("q6")
q7= Request("q7")
q8= Request("q8")
q9= Request("q9")
q10= Request("q10")
q11= Request("q11")




If q6 = "Yes" then
mailSubject="Employment Opp High "
else
mailSubject="Employment Opp Medium "
end if
'--------------------------------------- EMAIL FORMAT -----------------------------

Dim MyMail
Set MyMail = Server.CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

body = "<b>Name:</b> "& q1 &"<br>"
body = body & "<b>Email:</b> "& q2 &"<br>"
body = body & "<b>Phone:</b> "& q3 &"<br>"
body = body & "<b>City:</b> "& q4 &"<br>"
body = body & "<b>State:</b> "& q5 &"<br>"
body = body & "<b>If offered a management position with our company are you willing to relocate?:</b> "& q6 &"<br>"
body = body & "<b>Please gives us a description of your personal work history from childhood and explain why you think you would make a valuable addition to our team:</b> "& q7 &"<br>"
body = body & "<b>How many months have you been conducting your current employment search?:</b> "& q8 &"<br>"
body = body & "<b>How many employment opportunities have you submitted your resume for during this time?:</b> "& q9 &"<br>"
body = body & "<b>Please describe what you feel to be your greatest accomplishment in 500 words or less:</b> "& q10 &"<br>"
body = body & "<b>I would like to schedule a telephone interview:</b> "& q11 &"<br>"

With Flds
' assume constants are defined within script file
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.connectwise.com"
.Update
End With
With MyMail
Set .Configuration = iConf
.To = "jimi@HHS1.com"
.From = q2
.Subject = mailSubject
.HTMLBody = body

.Send
End With

Set MyMail = Nothing

%>

Again, I can add the field to upload a file, which you can see at the bottom of http://www.hhs1.com/questionnaire.html , but I cannot get that file to show up in the emaqil sent with the above code. Granted, I've not actually added anything to the ASP code since adding the FILE field to the form. I simply dont know what to do.

Help?

Thanks!

Jim
LVL 2
jimbonicsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

skumar159Commented:
Hi,

Add the following line within With ... End With block to attach a file:

With MyMail
       .AttachFile strFile
End With

In the above statements strFile should contain the physical path of the file located in the server (assumed that you've uploaded the file).

For example if the file is available under 'docs' folder :

strFile = Server.MapPath(".")
strFile = strFile & "\docs\" & filename

Regards,
Suresh

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.