ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 28th, 2003, 06:37 AM
Angelot Angelot is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 3 Angelot User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Howto: Attach a file with mail from form

Hi!

I'm trying to get my users to attach a local file to the mail they sending me from my page.

<B>My form code is:</B>

form method="POST" action="mail-annonse.asp" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1" language="JavaScript"

input type="text" name="FromName" size="20"
input type="text" name="FromAddress" size="20"

input type="file" name="AddAttachment" size="20"

input type="submit" value="Send" name="B1"
input type="reset" value="Reset" name="B2"

<b>My asp code is:</b>

Session("FromName") = Request("FromName")
Session("FromAddress") = Request("FromAddress")

Set Mailer = Server.CreateObject("SMTPsvg.Mailer")

Mailer.FromName = Session("FromName")
Mailer.FromAddress = Session("FromAddress")
Mailer.RemoteHost = "smtpgw.activeisp.com"
Mailer.AddRecipient "joachim@obur.no", "joachim@obur.no" Mailer.Subject = "Annonsering på obur.no"

for each whatever in request.form
If instr(whatever,"mail-")=0 then
Mailer.BodyText = whatever & "=" & vbcrlf
Mailer.BodyText = request.form(whatever) & vbcrlf & vbcrlf
end if
next

if Mailer.SendMail then
Response.Write "The e-mail is sendt..."
else
Response.Write "The mail was not sendt. The error was " & Mailer.Response end if

Session.Abandon

<b>How can I get it to work? Can I use something like:</b>
Session("AddAttachment") = Request("AddAttachment")
<b>and</b>
Mailer.AddAttachment = Session("AddAttachment")
<b>or</b>
Mailer.Attachments.Add = Session("AddAttachment")

<b>Please help...</b>

Angelot (joachim@obur.no)

Reply With Quote
  #2  
Old October 29th, 2003, 03:41 AM
Angelot Angelot is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 3 Angelot User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Somebody....

Please - sombody help!

Reply With Quote
  #3  
Old October 29th, 2003, 09:33 AM
mopacfan mopacfan is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 7 mopacfan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You first have to get the file to the server

Visit this thread for two different asp solutions. Both are FREE

You'll have to get the file to the server first, then attach it to the email. Once the email is sent, the file can be deleted. You won't be able to attach the file from the browser.

Michael

Reply With Quote
  #4  
Old October 30th, 2003, 02:35 AM
Angelot Angelot is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 3 Angelot User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanx

This was what I was looking for....

I'm trying it now, and I think it works great!

Again, thanx!

Angelot :-D

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Howto: Attach a file with mail from form


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway