?
Solved

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

Posted on 2008-10-09
5
Medium Priority
?
946 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
1 Comment
 
LVL 18

Accepted Solution

by:
vbturbo earned 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
There can be many situations demanding the conversion of Outlook OST files to PST format and as such, there is no shortage of automated tools to perform this conversion. However, what makes Stellar OST to PST converter stand above the rest? Let us e…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

839 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