Wrox Programmer Forums
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 21st, 2005, 12:58 AM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default Mailing with ASP attachment not working

Hi,
I have a mailing form where the details of a person can be entered & mailed. I am also using a file input where a text file can be sent through as attachment. The following code is used to send the mail and the attachment:

        attachmt=request.form("file1")
    response.write attachmt

    set mymail=server.CreateObject("Persits.MailSender")
    mymail.Host = "localhost"
    mymail.From="webteam@lnsel.com"
    mymail.AddAddress "arnabghosh05@hotmail.com"
    mymail.Subject="Job Application"
    mymail.AddAttachment request.form("file1")
    mymail.Body=str & str2
    mymail.IsHTML = True
    mymail.Send


here str & str2 are the texts received as request.form from the mailing form and I have used a variable as well as directly accessed the attachment using request.form.

The following error is showing when I am trying to send the mail:

System cannot find the file specified.

Though I am attaching a file that exists in the system.

Kindly help me if there is any mistake in my syntax or if there is any better way to attach files and sent through mail.
 
Old June 21st, 2005, 01:23 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

What is the value that you see in request.form("file1")?

_________________________
- Vijay G
Strive for Perfection
 
Old June 21st, 2005, 01:48 AM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The value I see is:

C:\text2.txt

This is the file I am attaching to the mailing form
 
Old June 21st, 2005, 06:24 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Where is the IIS hosted? And where is the C:\text2.txt present? Is that both on different systems?

_________________________
- Vijay G
Strive for Perfection
 
Old June 21st, 2005, 07:00 AM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes they are on different systems
 
Old June 22nd, 2005, 08:05 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Then the answer is "you cannot attach the file in your case." You can only attach the files that are from the webserver, provided you(here the IIS user) have enough permission to access that file. You cannot attach a file that is on a remote machine, in the view of the webserver. It is as simple as that.

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Send Mail with Attachment using Asp rajchennai J2EE 0 June 30th, 2007 01:39 AM
Mass Mailing in ASP.NET ghari ASP.NET 1.0 and 1.1 Professional 0 February 8th, 2006 02:04 AM
Mailing in ASP arnabghosh Classic ASP Basics 3 June 10th, 2005 04:53 AM
asp / access mailing list database problem srobert1 Access ASP 1 May 2nd, 2005 06:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.