[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


send email attachment

Posted on 2006-04-19
Medium Priority
Last Modified: 2012-05-05

i have an XmlDocument i want to email.   It does not have a file path - it is stored as a property of my class.

How do i do this?  without saving to file first.

i.e i want to say

MailAttachment attachment = new MailAttachment(this.myxmlDocument);  
Question by:MrKevorkian
  • 2
LVL 14

Expert Comment

ID: 16490599
That is not possible as far I as know. You will need to write the XmlDocument to your hdd and attach it that way.

Author Comment

ID: 16490662
just found out  you can do it in 2005 with system.net.mail.

LVL 14

Expert Comment

ID: 16491131
Could you post the url/code for it (to help some fellow coders)? ;)

Accepted Solution

HanZulu earned 980 total points
ID: 16491994
Since an Attachment in the SMTP Protocol requires that a file will be chosen from the Hard Disk
and not Memory, You will have to code internal routines that handle this.
Still the routines will be preparing a file that will be temporarly saved and deleted to the HardDisk,
But this way it will be transperent to you.

MailAttachment class should be created with 2 or more constructors. 1 for file name, 1 for file stream.
Second one should handle the file writing and attachment behind the scenes.


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month18 days, 18 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question