Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDO mail program has an attachment problem.

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi,

I'm having problems with the below. It works without the attachment feature. But with the included feature its not submitting???

--------------

<%
if Request.Querystring(&quot;isSubmitted&quot;) = &quot;yes&quot; then
Dim objCDO
Dim fname, lname, strFileName, lngAttEncode

fname = Request.Querystring(&quot;First_Name&quot;)
lname = Request.Querystring(&quot;Last_Name&quot;)
strFileName = Trim(Request.Form(&quot;txtattfile&quot;))
lngAttEncode = Trim(Request(&quot;optAttEncode&quot;))

Set objCDO = Server.CreateObject(&quot;CDONTS.NewMail&quot;)
objCDO.From = &quot;ELEXON TEST ASP MAIL!&quot;
objCDO.To = &quot;michael.dang@elexon.co.uk&quot;
objCDO.Cc = &quot;&quot;
objCDO.Bcc = &quot;&quot;
objCDO.Subject = &quot;Submitted form data from my page&quot;
objCDO.BodyFormat = 1
objCDO.MailFormat = 1
objCDO.Body = &quot;Name: &quot; & fname & &quot; &quot; & lname

if Len(Trim(strFileName)) > 0 Then
objCDO.AttachFile strFileName, , lngAttEncode
end if

objCDO.Send
Set objCDO = Nothing
ConfirmMsg = &quot;Thanks for submitting your name!&quot;
end if
%>

<html>
<head><title>ASP Send Mail</title></head>
<body>
<% if ConfirmMsg <> &quot;&quot; then %>
<h2><%= ConfirmMsg %></h2>
<% end if %>
<form action=&quot;aspmail.asp&quot; method=&quot;get&quot; name=&quot;Input_Form&quot;>

First Name: <input type=&quot;text&quot; size=&quot;30&quot; maxlength=&quot;50&quot; name=&quot;First_Name&quot;>
<br>Last Name: <input type=&quot;text&quot; size=&quot;30&quot; maxlength=&quot;50&quot; name=&quot;Last_Name&quot;>
<br>Comments <input type=&quot;text&quot; size=&quot;30&quot; maxlength=&quot;50&quot; name=&quot;Comments&quot;>

<br>Attach file: <input type=&quot;file&quot; name=&quot;txtattfile&quot;>
<br><input type=&quot;radio&quot; name=&quot;optAttEncode&quot; value=&quot;0&quot; checked>UUENCODE
<br><input type=&quot;radio&quot; name=&quot;optAttEncode&quot; value=&quot;2&quot;>Base 64

<input type=&quot;hidden&quot; name=&quot;isSubmitted&quot; value=&quot;yes&quot;>
<input type=&quot;submit&quot; value=&quot;Submit Form&quot;>

</form>
</body>
</html>
 
Chris,

I applaud your efforts, however I'm sorry to say that as much as it seems like that will attach the file to the email and send it, it actually will not. The <input type=&quot;file&quot;..> is simply a form element that comes with a Browse button that allows the visitor to select a file. And combined with a file uploader utility on the server, you can successfully upload the file.

Here's one of the best utilities out there, or you can just surf around the net and see if anyone's giving one away. Try Active Server Pages on Google. Here's where you can find one, and I believe it has free trial.


ToddWW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top