Solved

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Resolve DNS query failed errors for Exchange
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now