Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1160
  • Last Modified:

Send email with ABCUpload

bubs tried to help me with this but we got stuck in a corner.

I'm trying to use ABCupload to upload a file then send an email.

My form page that browses to find the file and then Uploads the file code looks like this..

<form method="post" action="upload_success.asp?email=<%=Server.URLEncode(Request.QueryString("Email"))%>">
                    <div align="left">
                  <input name="filefield" type="file" size="60">

                  <input type="submit" name="submit" value="Upload File">

The processing page looks like this...

<!-- Send Email -->
'Declare variables
Dim sMsg
Dim sTo
Dim sFrom
Dim sSubject
'Dim sTextBody 'use one or the other
Dim sHTMLBody

'Get data from previous page
Set theForm = Server.CreateObject("ABCUpload4.XForm")
sTo = theForm("Email")
theForm.Overwrite = True
theForm("filefield")(1).Save theForm("filefield")(1).FileName

'sTo = Request.Querystring("Email")
sFrom = ""
sSubject = "MobileDataforce Leads Uploaded"
'sTextBody = Request("sTextBody") 'use one or the other
sHTMLBody = Request("sHTMLBody")

Dim objMail
'Create the mail object
Set objMail = Server.CreateObject("CDO.Message")
'=== Code added here to specify SMTP server and port

objMail.Configuration.Fields.Item("") = 2
objMail.Configuration.Fields.Item("") = ""
objMail.Configuration.Fields.Item("") = 25


' build HTML for message body
sHTMLBody = "<HTML>"
sHTMLBody = sHTMLBody & "<HEAD>"
sHTMLBody = sHTMLBody & "<BODY>"
sHTMLBody = sHTMLBody & "<font face='Arial' size='2'>Greetings,</font></br>"
sHTMLBody = sHTMLBody & "<p><font face='arial' size='2'>New leads have been uploaded to your section of the MobileDataforce partner site. Thanks for checking on this prospective customers</font></p>"
sHTMLBody = sHTMLBody & "<br>"
sHTMLBody = sHTMLBody & "<font face='Arial' size='2'>Regards,</font>"
sHTMLBody = sHTMLBody & "<br><br>"
sHTMLBody = sHTMLBody & "<font face='Arial' size='2'>Kevin Benedict</font>"
sHTMLBody = sHTMLBody & "<br>"
sHTMLBody = sHTMLBody & "0==============================0"
sHTMLBody = sHTMLBody & "<br>"
sHTMLBody = sHTMLBody & "<font face='Arial' color=blue size='2'>Kevin Benedict</font><br>"
sHTMLBody = sHTMLBody & "<font face='Arial' size='2'>MobileDataforce</font><br>"
sHTMLBody = sHTMLBody & "<font face='Arial' size='2'>Office (208) 288-2745 ext. 250</font><br>"
sHTMLBody = sHTMLBody & "<font face='Arial' size='2'>email <a href=''></a><br>"
sHTMLBody = sHTMLBody & "0==============================0"
sHTMLBody = sHTMLBody & "</BODY>"
sHTMLBody = sHTMLBody & "</HTML>"

'=== End code to specify SMTP server and port
'Set key properties
objMail.From = sFrom
objMail.To = sTo
objMail.Subject= sSubject
'objMail.TextBody = sTextBody 'use one or the other
objMail.HTMLBody = sHTMLBody

'Send the email
'Set sMsg which will be used later
sMsg = "Your message was sent to: " & sTo

Set objMail = Nothing

<!-- Upload Files -->

I get the following error...
ABCUpload4.XField.4 error '80004005'

Unable to convert virtual to physical path. A Windows error - Unspecified error - (0x80004005) occurred.

/partnersite/regions/Ztest/upload_success.asp, line 40

Perhaps I should try using a hidden field on the first page to get the email. I'm just not sure.

  • 3
  • 3
2 Solutions
Which is line 40?

The error you're getting doesn't sound like a mail object error. It sounds as if the ABCUpload component can't save the file you've specified. I did notice one thing: Typically when you use a file field, you have to include enctype="multipart/form-data" in your form tag. I don't know if ABCUpload requires this, but other components I've used will produce an error if the entype is not set to this. Otherwise, your message code seems to look okay, though I'd like to ask why you use the base object (CDO) instead of CDONTS. Understandable if your mail server is different from your web server.

kevinbenedictAuthor Commented:
line 40 is

theForm("filefield")(1).Save theForm("filefield")(1).FileName

I think I'm supposed to add the multipart/form-data. I'll go add that and see what happens.

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

kevinbenedictAuthor Commented:
When I add the multipart/form-data and submit the form I get the following...

Request object error 'ASP 0208 : 80004005'

Cannot use generic Request collection

/partnersite/regions/Ztest/upload_success.asp, line 46

Cannot use the generic Request collection after calling BinaryRead.

line 46 is

sHTMLBody = Request("sHTMLBody")
sHTMLBody = Request("sHTMLBody")

will have to be something like:

sHTMLBody = theForm("sHTMLBody")

kevinbenedictAuthor Commented:
Perfect. That got it.
Glad to have helped,

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now