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

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.

Related

Open mail client from browser with an byte[] attachment from the server

I looked on SO an found several ways to do kind simmilar things, but those aren't the solution.
A user is on the web page and on a click on a file (which is stored in byte[] on server) should open the mail client, where the attachment, subject and mailfrom is set.
Subject and Mail From is no problem, but the attachment. Here are some points I need/need not to:
I cannot/I am not allowed to Create a file such as mymailmessage.eml
on a client (access denied)
I cannot use MailMessage
(System.Net.Mail) because for this I need to create a file to open the mail client with Process.Start(filename)
I cannot use mailto: because there I cannot add an attachment
So the way I am on for now is to use MAPI. Unfortunately I have not found a solution. My source is a byte[] and I can write this in a MemoryStream. Is it possible to create a kind of virtual file path in C#? But I don't know how to open the mail client including the parameters. All the MAPI projects (like https://github.com/PandaWood/Simple-MAPI.NET or https://www.codeproject.com/Articles/10881/MAPIEx-Extended-MAPI-Wrapper are using local files. I tried those, but in my case the mail client isn't starting, so no mail message window is popping up.
So what I am looking for is: Create a MapiMessage with MailFrom, Subject, an attachment and then open the mail client (like with mailto) including the attachment.
An other C# project is this: https://www.codeproject.com/Articles/17561/Programmatically-adding-attachments-to-emails-in-C
According to this codeproject, I cannot find the line, where the programm is saying the mail client please open (like Process.Start()) and open the prepared mail message for me.
Is there any other way except MAPI, when I only have a byte[] in the web application and need to open a mail client message including the attachment not storing/downloading it on the user client?

Send email without leaving a copy in the Sent folder outlook c#

When i am sending mail through outlook in c# ,all the mails are saved in sent box. Is there any way which does not leave the copy of mail in sent folder programatically.
Set the MailItem.DeleteAfterSubmit property to true before calling Send.

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

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?

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