Solved

Send email with ABCUpload

Posted on 2004-09-02
7
1,110 Views
Last Modified: 2012-05-05
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">
                <p>
                  <input name="filefield" type="file" size="60">
                  <br>
                 

                  <br>
                  <input type="submit" name="submit" value="Upload File">
                </p>
              </div>
</form>

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
'response.Write(Request.QueryString("email"))
'Response.End()
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 = "kevin@mobiledataforce.com"
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("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.fiberpipe.net"
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objMail.Configuration.Fields.Update

' 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='mailto:kevin.benedict@mobiledataforce.com'>kevin.benedict@mobiledataforce.com</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
objMail.Send
'Set sMsg which will be used later
sMsg = "Your message was sent to: " & sTo

'Clean-up
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.

Thanks
J
0
Comment
Question by:kevinbenedict
  • 3
  • 3
7 Comments
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11964064
Which is line 40?

FtB
0
 
LVL 12

Assisted Solution

by:GoofyDawg
GoofyDawg earned 200 total points
ID: 11964351
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.

GoofyDawg
0
 

Author Comment

by:kevinbenedict
ID: 11964596
ftb
line 40 is

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


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


0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:kevinbenedict
ID: 11964693
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")
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 150 total points
ID: 11965441
sHTMLBody = Request("sHTMLBody")

will have to be something like:

sHTMLBody = theForm("sHTMLBody")


FtB
0
 

Author Comment

by:kevinbenedict
ID: 11966036
Perfect. That got it.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11966094
Glad to have helped,

FtB
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now