Solved

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

Posted on 2008-10-09
5
938 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Suggested Solutions

Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

730 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