This is a migrated thread and some comments may be shown as answers.

how to send radupload attachments through smtp on IIS

3 Answers 126 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Saimadhukar
Top achievements
Rank 1
Saimadhukar asked on 04 Nov 2011, 07:06 AM

hello,

i am working on email functionality and recently i  am using rad uploader to upload files and send to mails through smtp connection.the code that i wrote working fine in localsystem,but when we deploy it on IIS(V 5.1 or 7) it is getting error,path cannot be found /access  to path is  denied ,i am sending code block  please reply soon ,Thanks.

System.Net.Mail.Attachment attachment;
           foreach (UploadedFile file in RadUpload1.UploadedFiles)
           {
               try
               {
                   string strFileName = null;
                    strFileName = System.IO.Path.GetFullPath(file.FileName);
                   attachment = new System.Net.Mail.Attachment(strFileName);
                   Message.Attachments.Add(attachment);
                  }
         catch
           {
           }
    }

 

3 Answers, 1 is accepted

Sort by
0
Saimadhukar
Top achievements
Rank 1
answered on 07 Nov 2011, 01:25 PM
hello ,
sending attachments through rad uploader is solved by adding file.InputStream in attachment

attachment =

 

new System.Net.Mail.Attachment(file.InputStream, strFileName);

 

but we are getting a url of path in mail to which we are sending it while downloading from their inbox . is there any way to hide the path and display only attachment name ,please respond thanks. 
0
Accepted
Kevin
Top achievements
Rank 2
answered on 07 Nov 2011, 02:15 PM
Hello Saimadhukar,

Change you code to this:

attachment = new System.Net.Mail.Attachment(file.InputStream, file.GetName());

I hope that helps.
0
Saimadhukar
Top achievements
Rank 1
answered on 08 Nov 2011, 07:02 AM
Hello Kevin,

thank u that works fine..
Tags
Upload (Obsolete)
Asked by
Saimadhukar
Top achievements
Rank 1
Answers by
Saimadhukar
Top achievements
Rank 1
Kevin
Top achievements
Rank 2
Share this question
or