.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

attachment in email

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :ASP.Net
hi i have a page for getting the information from students about their academics.i am sending this detail to client email id on the click of sbmt.i do have a file uploader in that page for uploading resume.hw can i send this resume to clietn email as an attachment as word file. 

View Complete Post

More Related Resource Links

how to send email in asp.net with attachment c# code

 SmtpClient smtpClient = new SmtpClient();         MailMessage message = new MailMessage();         try         {             MailAddress fromAddress = new MailAddress(txtEmail.Text, txtName.Text);             // You can specify the host name or ipaddress of your server             // Default in IIS will be localhost              smtpClient.Host = "localhost";             //Default port will be 25             smtpClient.Port = 25;             //From address will be given as a MailAddress Object             message.From = fromAddress;             // To address collection of MailAddress             message.To.Add("admin1@yoursite.com");             message.Subject = "Feedback";             // CC and BCC optional             // MailAddressCollection class is used to send the email to various users   

EWS save email attachment (ItemAttachment)

Hello, I'm using Exchange Webservices. I try to save an email attachment which is a email itself. It is not a FileAttachment, but an ItemAttachment. We are running Exchange 2007. I use .NET c# foreach (Attachment att in mail.Attachments) { // Save normal files to disk<br/> if (att is FileAttachment) { FileAttachment fa = (FileAttachment)att; String s = @"..\attachment\" + att.Name; fa.Load(s); } <br/> // Save attached EMails to disk<br/> if (att is ItemAttachment) { what to do here?<br/>  }   Any ideas? I tried to cast Item Attachment to Fileattachment, but it does not work. Thank you very much! Best regards!

How do you extract data from the xml attachment of an incoming email and set it as metadata in a doc

Hi, I currently have a document library that contains InfoPath forms. As a form is loaded into the document library I need the data to be extracted from the infopath file and then set as properties/metadata of the file. The infopath forms will be sent to the SharePoint site as an email attachment. So basically, an email is sent to the SharePoint server with an InfoPath form as an email attachment. The InfoPath form needs to be extracted from the email and uploaded to the document library and at the same time updating the document library metadata with the infopath form data. This has been done using Visual Studio but can this be done using SharePoint Designer 2010 now that we have upgraded our site to SharePoint 2010? Any guidance will be greatly appreciated! Thanks Michael

Email Attachment Problem

hi everyone,I am having a chart, and want to be able to click the "send it by email" and then popup an email window with the chart on the attachment.However, the attachment does not show.here is my code: string ServerPath = Protocol + Request.ServerVariables["SERVER_NAME"] + Port + Request.ApplicationPath + @"/graphs/" + User.Identity.Name + graphID + ".jpg"; string mailToString = "mailto:?subject=Trade Graph&Body=See attachment for the charts, or please click: " + ServerPath + "&Attachment="+ServerPath; string popupScript = "<script language='javascript'>" + "window.open('" + mailToString + "', 'CustomPopUp', " + "'width=200, height=200, menubar=yes, resizable=no')" + "</script>"; Page.ClientScript.RegisterStartupScript(typeof(Page), "PopupScript", popupScript); thank you guys!

How To Save Pdf File In Client's Computer For Sending As Email Attachment


Hello everybody.

The subject of this thread is my question and I am really very sorry, I cannot brief it. I have generated the pdf file which contains text taken as input by various web-form and have saved it in my local drive then sended it to some email addresses. Now I want to know that how can I save it in client computer and send it to some email addresses provided by Client on demand?

I am failed to solve this problem as I don't know how to get INFORMATION OF CLIENT'S LOCAL DRIVE AS CLIENT MAY USES DIFFERENT OPERATING SYSTEM.

Any information will be very helpful to me.

Thank you.

SharePoint 2010 Incoming Email cannot process email file attachment in email with less than sign < a


When sending an email which contains an email attachment such as "Hello <World>.msg" from Outlook to SharePoint 2010 email enabled list such as an "Announcements" list, no item is created in the list and the attached email and the orginal email are not saved.

The log file contains

09/23/2010 13:51:17.54  OWSTIMER.EXE (0x18FC)                    0x0B2C SharePoint Foundation          E-Mail                         6873 Warning  An error occurred while processing the incoming e-mail file C:\inetpub\mailroot\Drop\f17ce37101cb5b600000002a.eml. The error was: Illegal characters in path.. 9f265722-74c9-4bd8-9504-ac265f2351d7

SharePoint 2010 Incoming Email cannot process file attachment with zero size.


When sending email with attachments to SharePoint list, if one of the file attached to the email is of size 0, then none of the files will be saved and NO new item will be created in the list.

The SPEmailHandler's ProcessAttachment method should check the length of the "contentStream". If the length is 0, it should return immediately.

As you can see in the ProcessAttachment method none of the arguments are validated before they are used. This an example of poor quality code.

It should do at least

if (contentStream == null || contentStream.Length == 0) return;

if (string.IsNullOrEmpty(fileName) || item == null) return;


private static void ProcessAttachment(Stream contentStream, 

memorystream attachment on an email



Sorry if this is the wrong forum, couldn't find a mail or IO forum. I'm trying to attach a memorystream as an attachment to an email, however the file is always empty. I'm using a streamwriter to write the text in to the memorystream, I then flush the streamwriter and I can see the memorystream has data. However when I attach the memorystream to the email the file is always empty. I can't see what I'm doing wrong. Any help would be great. The code is:

                    System.IO.MemoryStream memorystream = new System.IO.MemoryStream();
                    System.IO.StreamWriter streamwriter = new System.IO.StreamWriter(memorystream);
                    Attachment data = new Attachment(memorystream, fName, MediaTypeNames.Application.Octet);
                    SmtpClient smtp = new SmtpClient();

var4 is a string of XML data.






How to generate an excel and send it as email attachment in SSIS 2005 Script Task Component?


I am using a "Script Task" component. I am trying with following three simple steps:

1) Obtain the excel content in HTML

Dim reportInHtml As String = GenerateHTMLReport()

2) Generate an excel with below code:

Dim message As MailMessage

message = New MailMessage(fromAddress, toAddress, subject, String.Empty)

Using memoryStream As MemoryStream = New MemoryStream()

        Dim contentAsBytes As Byte() = Encoding.UTF8.GetBytes(reportInHtml)
        memoryStream.Write(contentAsBytes, 0, contentAsBytes.Length)
        memoryStream.Seek(0, SeekOrigin.Begin)

        Dim contentType As ContentType = New ContentType()
        contentType.MediaType = "application/ms-excel"
        contentType.Name = "Excel_Report.xls"

        Dim excelAttachment

sending email as a text attachment with tab delimited fields


Hi All,

How can I send email as a text attachment with tab delimited fields in asp.net

I need to create text.txt with first name , last name, ....etc  added to it (tab delimited)




How to send an email and search for attachment


 I know how to send an email.  But now I want to send an email with an attachment.  I also want to allow the user to browse for and then select the attachment.  I cannot seem to find any info on this.  All the articles I find show how to attach a file where you know the path and file name.  I want the user to browse their drive, select a file, and then send an email with this attachment.

Can anyone help?




Adding multiple attachment (files) to a dynamic variable so it can be send to a email. VB 2010


Hello !

I need some advice on what to use for adding multiple attachment to a email. I'm using VB 2010.

First, I have a Form in my company web site to fill a reclamation ..... when you fill and send it, it convert the form into a PDF, save it in the client side "TEMP" and finally get the PDF and send it to a email..... that's perfectly  fine. I add to the form the capability of attach multiple files with file upload to the same "TEMP" and displayed in a Grid View to remove or add files and send everything to a email, the attachment capability is working. Everything is working with the PDF not the files(attachments). 

There is a way to get the multiple files from the "TEMP" folder and add it to some dynamically variable (array list, attachment collection, list collection, etc.) so all can be send to the email. I already know the way to put it into the email with the PDF. The problem is to get the files and add it to the dynamic variable and that it work with the email.

If the code is need it, let me know.


email as an attachment


Hello.  Have a question regarding making an email an attachment.  Users would like to be able to take emails they receive (Inbox in Outlook) and add them as attachments to a record.  The webapp is connected to a sql server database.  I am thinking that the actual email would not be stored in the database but rather the name and pathway to the storage folder on the network.  Attachments (email or otherwise) would be displayed in a gridview and accessible from there.  I know there is the fileupload control and they may be used or something similar.  I have been googling but have not found anything about making an email as an attachment.  Is it even possible?  If so, do you know of a site that explains how?

Thank you for your time and review of this post.

... John

Send Email with HTTP file attachment - Workflow is sending garbage in attachment



I'm having an issue with a customized workflow when I send an email with an attachment. I am using the "send email with http file attachment" that I have downloaded from CodePlex. Unfortunately all attachments that come through are full of garbage. This includes .jpg, .pdf, and .txt. From what I can tell with the .txt file is that its contents has been replaced with what appears to be the html of the list page. Both the .jpg and .pdf fail to open complaining about corrupt documents. All documents can be opened fine from within sharepoint. 

Can anyone of you guide me in this regard, as rest of my  workflow logic is working fine but this attachment issue is ruining the end result.


Email Active View vs. Email Attachment in InfoPath 2007


I'm developing an InfoPath 2007 form that is based on an existing InfoPath 2003 form.  When the form is submitted, the customer wants the email message to display the active view of the form and wants the form attached as well.  However, she wants the attached form to display some different fields than the view (don't ask me why).

My question is, is this possible?  I am not aware that you can separate what is in the active view and what is in the attachment (wouldn't the attachment have to be what is showing in the active view anyway?)  She swears the 2003 version of the form achieved this functionality.  I've tried a couple things (hiding/unhiding fields based on rules, switching views), but the view and the attachment always com out the same.  If anyone has any insight, it would be greatly appreciated.  Thanks.

sharepoint 2010 Document Library - Email as attachment


I am disappointed to see that SharePoint 2010 does not appear to offer the ability to send a document from a document library as an attachment.  We use Sharepoint to control our documents as such we forbid, by policy, storing local copies of documents as there is no way to ensure that they are the current version (cached local kept in sync with a sharepoint library is allowed).  When Sales, Marketing, Customer Service wants to send a set of documents to a customer, they currently copy all the documents they need to a temp folder on their computer, attach all the documents from the folder to an email, then delete the temporary folder.  

I was hoping with all the improved integration, that the library and more valuable would be a view of the library (as it is filtered and sorted) would be accessible to use when selecting attachments. Or the reverse - select a set of documents from a library view and choose email as attachment.    

 The closest options I have come up with is to open the library in explorer which allows dragging and dropping the documents into the email, but there does not appear to be a way to search or filter the items in the explorer view of the library. 

Help me out, is there a better way to do this?  Can Sharepoint workspace help me here?   This is a common complaint at my o

PrintPocketCE Print Pocket Excel, Pocket Word and email files

Version 3.560 (May 15, 2009):

Important bug fix: a slight difference in how some devices create fonts was causing a few devices to have significantly longer print times for large print jobs.

Adjusted PocketJet printer paper feed commands

Other minor fixes and enhancements.

Version 3.559 (Mar 5, 2009):

Added support for Martel MCP78xx printers

Version 3.558 (Aug 20, 2008):

Added support for Martel MCP78xx printers

Version 3.557 (June 27, 2008):

Fixed error in Canon printer support

Fixed COM0 port selection

Version 3.556 (June 15, 2008):

Added support for Brother MW-260

Added support for Sato MB400

Version 3.555 (Aug 8, 2007):

Added support for Pentax RuggedJet 3 and RuggedJet 4 printers

Changed Epson TM-P60 support to maximum page width of 1200 dots

Version 3.551 (Aug 1, 2006):

Added Peripheral Nomad printer support

Version 3.550 (Mar 23, 2006):

Added Panasonic JT-H200PR printer support

Added Pocket Spectrum printer support

Fixed problem with WM5.0 "inverted image" problem
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend