Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
email a file attachment from form
Old 04-05-2006, 06:02 PM email a file attachment from form
Average Talker

Posts: 26
Trades: 0
Hi guys can you please help me where I am wrong in my code since I can get email but with no attachment.

Thanks,
Elham
----------------
<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows Library" -->
<!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4" NAME="ADODB Type Library" -->
<%
SUB sendmail( fromWho, toWho, Subject, Body )
Dim objCDO
Dim iConf
Dim Flds
Const cdoSendUsingPort = 2
Set objCDO = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = MailServer
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPconnectiontimeout) = 10
.Update
End With
Set objCDO.Configuration = iConf
objCDO.From = fromWho
objCDO.To = toWho
objCDO.Subject = Subject
objCDO.TextBody = Body
objCDO.Send
END SUB

Dim Domainname
Dim MailServer
Dim From
Dim subject1
Domainname = "pinepress.com"
MailServer = Request.Form("MailServer")
subject1 = "IDS-7934969 - "
fromWho = Request.Form( "fromWho") + "@pinepress.com"
toWho = Request.Form( "toWho") + "@hotmail.com"
toAttachment= request.Form("toAttachment")
Subject = TRIM( Request.Form( "Subject" ) )
Body = TRIM( Request.Form( "Body") )
send_mail = Request.Form( "send_mail")
If send_mail <> "" THEN
sendMail fromWho, toWho, Subject, Body
'Cleanup
Set ObjCDO = Nothing
Set iConf = Nothing
Set Flds = Nothing
END IF
%>
<HTML>
<HEAD><TITLE>Email Form</TITLE></HEAD>
<FORM METHOD="POST" ACTION="<%=Request.ServerVariables("SCRIPT_NAME")% >">
<BR>Server:
<SELECT NAME="MailServer">
<option value="mail-fwd">mail-fwd
<option value="mail-fwd.boca15-verio.com">mail-fwd.boca15-verio.com
</select>
<BR>TO: <INPUT NAME="toWho" TYPE="text" SIZE=10>@hotmail.com
<BR>FROM: <INPUT NAME="fromWho" TYPE="text" SIZE=10>@pinepress.com
<BR>Attachment : <input name="toAttachment" type="file" />
<BR>SUBJECT: <INPUT NAME="Subject" TYPE="text" SIZE=25>
<BR><TEXTAREA NAME="Body" COLS=50 ROWS=5>This is a test for pinepress.com.</TEXTAREA>
<BR><INPUT TYPE="SUBMIT" VALUE="SUBMIT" name="send_mail">
</FORM>
</HTML>
elham is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-05-2006, 08:09 PM Re: email a file attachment from form
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
it's probably because you haven't attached anything in your code!

objCDO.AddAttachment "PathToFile"

the file to be attached will have to be uploaded to the server first of course.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-05-2006, 08:46 PM Re: email a file attachment from form
Average Talker

Posts: 26
Trades: 0
Thanks a lot.
Elham
elham is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to email a file attachment from form
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12571 seconds with 12 queries