Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
2
Answers
Open Outlook from .Net Application
b b
14y
3.4k
1
Reply
Hi All,
I want to open Outlook from my .net application with attachment.
I am using the following codes and its sending mails properly.
But its attaching the file in mail body area instead of attachment field of outlook. I want to attach the file in attachment textbox of outlook. Can anyone help me please.
Outlook.Application oApp = new Outlook.Application();
Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
Outlook.Recipient oRecip = (Outlook.Recipient)oMsg.Recipients.Add("e-mail address");
oRecip.Resolve();
oMsg.Subject = "";
oMsg.Body = "";
String sSource = "C:\\test.txt";
String sDisplayName = "MyFirstAttachment";
int iPosition = (int)oMsg.Body.Length + 1;
int iAttachType = (int)Outlook.OlAttachmentType.olByValue;
Outlook.Attachment oAttach = oMsg.Attachments.Add(sSource, iAttachType, iPosition, sDisplayName);
oMsg.Display(true);
Regards,
B
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
GridView Pagie navigation gives Error randomly
Open Outlook Express using .Net Application