How to create Outlook's new mail window with attachement in? - c#

I'd like add to my app function allowing sending email via Outlook same as eg Adobe Reader does.
So after pressing email button I'd like to see Outlook's native 'new mail' window with my document attached in.
Any idea how to archive that?

Why not interop?
http://support.microsoft.com/kb/819398

Not quite a solution, but more of a hint: maybe creating an *.eml file with your attachment and opening it (as a new mail window) would help?

Related

Change what file an Outlook attachment points to

For instance, I have a word document as an Outlook attachment. I want to have a C# program that will find that file's local location, process it into a PDF, and then change the email's attachment to that new PDF file. The next time that attachment is opened, it will open the PDF and not the word document.
Edit 1: The email attachment is in my inbox, as someone has sent this file to me. I am able to edit the actual word file just like any other document just fine. I figure this would be possible by adding
Is this function possible? and remoreceived chments to existing recieved emails as well.
Yes, that is possible. You can develop an Outlook COM add-in (for example, a VSTO based one). The Attachment class provides the SaveAsFile method which saves the attachment to the specified path. Then you can automate Word where you may open the file just saved and re-save it using the .pdf file format. Or you may consider using third-party components that don't require Word installed on the system. After converting the document and getting the required pdf file you may remove an old attachment and re-add a new one. The Attachments.Add creates a new attachment in the Attachments collection.
You may find the following articles helpful:
Attach a File to a Mail Item
Modify an Attachment of an Outlook Email Message
How To: Add an attachment to an Outlook e-mail message

How do I open the default mail client and create an email?

I want to open the default mail client registering on Windows and create an email with an attachment.
The behaviour is just like when you right click on a file, the Send to -> Mail Recipient. Or when you compressing a folder and select 'compress and email' on the context menu.
I have tried:
mailto:xxx#example.com, which doesn't accept attachment.
MAPI, which works well when the outlook is shutdown, but doesn't work when the outlook is currently working. Do you know how to make it work?
Do you have any other ideas?
Thanks!
Depending on the version of your mail client, try to add &attach="C:\some_file.txt to the end of mailto:xxx#xxx.com. This should add an attachment when the mail client opens. If attach does not work, try attachment in stead. I wonder if you can't add both.

Bypass "Program is trying to access ... Outlook" Dialog Box

I'm facing one issue while writing Office Outlook 2007 Add-In, I'm accessing the email contents of email currently being sent by capturing Send event. Everything works fine but when accessing the subject/body of the email through Outlook.MailItem object (in C#), it prompts a dialog box to allow/deny this program to access. Can anyone help how to bypass this dialog box and allow the program to access MailItem ?
Thanks
Safiullah
I don think it is possible, MSFT has placed this alert box to avoid an illegal mail box access by malicious program... However, following guys claim that they can by-pass:
http://www.ablebits.com/programming-outlook-security/index.php

C# and Lotus notes attachment icon

I am using C# and need to attach a lnk (shortcut/link) file and email it to a lotus notes account. The problem is the icon defaults to a generic image and does not show the folder with the arrow as seen in Windows Explorer. A txt file icon does display as expected. I would like to control the appearance of that icon after it has been received. Can this be done through C# or is the Notes server the problem?
I think you are asking how to control the appearance of the icon once it arrives in the recipient's mail.
I do remember (from when we were on Notes here at work) that the icon was specific to the sender as opposed to the recipient (i.e. if I send you a Word document and I have Word 97 installed and you have 2003 installed, you'll see the Word 97 doc icon). But this appeared to be a function of the fact that I, the sender, was using Notes as the sending client. However, I think you may not be able to do what you want to do as one would assume you are sending regular SMTP e-mail. Assuming you are sending e-mail through the Notes server's SMTP interface, I don't believe you'll be able to control how the link appears on the recipient's side.

C# opening up a blank email with an attachment using Exchange

I'm new to the world of C# programming but was hoping someone could help me out.
I'm trying to use C# to open up a blank email in Outlook with a specified attachment.
In other words, open the email, the TO: and SUBJECT: fields are blank but the email has an attachment that is specified in my code. I want my user to be able to modify the email and send to whatever users s/he specifies. I know for sure that we have Exchange....so any ideas?
There are a number of way you can do this.
Create an Outlook addin that opens a new mail with the attachment you want via say a new toolbar button.
Do the same in Outlook VBA macro ..
Also you could create a new form with the attachment in it already and then just us that form.(but the attachment will be hard coded etc.)
Does the attachment change ? or is it the same one evey time ? what outlook version are you using ? What are you programing capabilties ?
76mel
I don't think exchange will help you much, you need to work with outlook on the users machine. You can add a reference to the Outlook interop assemblies, should be in the Com tab of your add references dialog.
Here's some links to jump start you.
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.aspx
http://www.microeye.com/resources/res_tech_vsnet.htm
Good Luck!

Categories

Resources