Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
how to do when we clicked button i want to open the new MailMessage windows which in the outlook by using C# in the windows forms
plz thanks in advance.i find out the code
 

private void btnoutlookmail_Click(object sender, EventArgs e)
{
 

Microsoft.Office.Interop.Outlook.Application outlookApp = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.MailItem outlookmail = (Microsoft.Office.Interop.Outlook.MailItem)outlookApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
outlookmail.To = "";
string address = outlookmail.Recipients[1].Address;
outlookmail.Subject = "Attaching Chart";
outlookmail.Body = "this is a mail for sending chart";
outlookmail.HTMLBody = " This will display in Bold";
outlookmail.Display(true);
 
}
 
But how can i retrieve data from sqldatabase to insert into outlookmail fields To,subject and Body
 
how to do ?plz tell me
Posted 14-Oct-12 21:28pm
Edited 15-Oct-12 0:27am
v2
Comments
OriginalGriff at 15-Oct-12 3:10am
   
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Use the "Improve question" widget to edit your question and provide better information.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Freind, Give your default email id as a link and ask user to click on the same it will open the new mail box on your machine.
also I am agree with O'Griff that be specific.
 
Thanks,
Ambesha
  Permalink  
Comments
Member 11505660 at 12-Mar-15 2:40am
   
hello, i have windows form application using c# with .net 3.5.
i have used outlook 2007(Microsoft Outlook 12.0 Object Library) calender and appointment in my windows form to insert and display appointment.i have inserted appointment. but now i want to open outlook on my windows form and display appointment. is there any way to open outlook in windows form?
{i am using vs 2010}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 600
1 OriginalGriff 455
2 Sascha Lefévre 289
3 Richard Deeming 195
4 Abhinav S 190
0 Sergey Alexandrovich Kryukov 9,693
1 OriginalGriff 9,185
2 Peter Leow 5,112
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 2,876


Advertise | Privacy | Mobile
Web04 | 2.8.150327.1 | Last Updated 15 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100