Solved

How do you add attachment to default email program using C# 2005

Posted on 2008-10-09
5
935 Views
Last Modified: 2013-12-17
How do you add attachment to default email program using C# 2005, if you have a collection of images or other file types? How would you go about calling the default email program on somone's PC and automatically attaching the document to that default e-mail provider softwre. (For an example, let's say that this is using Microsoft Outlook 2007)
0
Comment
Question by:hittabusta420
5 Comments
 
LVL 18

Accepted Solution

by:
vbturbo earned 500 total points
ID: 22735941
Hi


for OL 2000 2003 etc...


Using Microsoft.Office.Interop  ;


    private void Button1_Click(object sender, System.EventArgs e) {
        Outlook.Application OutL = new Outlook.Application();
        Outlook.MailItem Mail = ((Outlook.MailItem)(OutL.CreateItem(Outlook.OlItemType.olMailItem)));
        ArrayList al = new ArrayList(2);
        int Counter;
        al.Insert(0, "c:\\Test.xls");
        al.Insert(1, "c:\\Test1.xls");
        al.Insert(2, "c:\\Test2.xls");
        Mail.To = "Mr...";
        Mail.Subject = "Attachments";
        Mail.Body = "Message";
        for (Counter = 0; (Counter
                    <= (al.Count - 1)); Counter++) {
            Mail.Attachments.Add(al[Counter].ToString);
        }
       Mail.Display();
       // Mail.Save();
       // Mail.Send();
        Mail = null;
        OutL = null;
    }




have look here though this is not trough OL.

net 1.1
http://www.systemwebmail.com/

net 2.0
http://www.systemnetmail.com/

vbturbo
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Find out what you should include to make the best professional email signature for your organization.
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 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