C # Distributes the Outlook interface and sends the specified attachment

zhaozj2021-02-17  55

The C # calling the OUTLOOK interface is sent to the email, but all will call up the simple interface, set the recipient address, mail title, and body content, etc., but very small for the specified attachment. It is also realized, but it is to introduce Outlook object library. I don't want to introduce so much in this little function. It is too disgusting! Just also want to add this small feature to CrossFile2.0, so I carefully study the call of Outlook, I can find it or have a simple way, and the existing sharing is as follows:

Microsoft.win32.registryKey rkey = microsoft.win32.registry.classessroot.opensubkey (@ "mailto / shell / open / command"); // We find the system's default mail client, other customer programs I have not tried , I don't know if this approach is feasible.

IF (rkey! = null)

{// Find where the Outlook application is located, you can also use other ways to check

String path = rkey.getvalue (""). Tostring () "";

PATH = path.substring (0, path.indexof ("));

Path = path.replace ("/" "," ");

Rkey.close ();

Try

{

System.diagnostics.Process.start (path, "-c ipm.note / m myfriend@hotmail.com&subject=hello" this._imagepath); // Call execution Outlook, the main pay attention to the back parameters, the file address space of the attachment open

}

Catch

{

}

}

转载请注明原文地址:https://www.9cbs.com/read-29330.html

New Post(0)