https://gist.github.com/SelimBasyouni/efec48a197bfefb59d4ff75797aae15e
Creating and Sending an Email through "New Outlook" from a Desktop Application
Hello everyone,
Previously, we have been creating emails through our desktop applications, which can be edited and sent using various email programs. These emails, along with the recipients, subject, content, and attachments, are pre-formulated within our programs, and then the user can proceed to edit and send them.
However, as the "New Outlook" no longer supports, nor will it continue to support, the COM-Interop interface, we are currently looking for an alternative. Creating .msg or .eml files is not an option, as these cannot be edited or sent using "New Outlook".
Would anyone be able to advise a method for programmatically creating an email that can be edited and sent through Outlook?
Best regards,
Selim Basyouni
Microsoft 365 and Office Development Other
Outlook Windows Classic Outlook for Windows For business
3 answers
Sort by: Most helpful
-
-
Selim Basyouni 45 Reputation points
2024-07-24T09:59:07.26+00:00 Hello @mixxxel and everyone facing the same problem,
Luckily i found a solution for this issue. Using .Net, you can easily create eml. Files. Adding 'X-Unsent: 1' to the first line will make 'The New Outlook' to open that mail as draft, allowing you to edit and send the Mail.
Best regards
Selim BasyouniExample C# Code:
// Erstellen einer neuen E-Mail-Nachricht MailMessage mail = new MailMessage(); mail.From = new MailAddress("sender@example.com"); mail.To.Add("******@example.de"); mail.Subject = "Test"; mail.Body = "Das ist eine Test eMail."; // Speichern der E-Mail in einer .eml-Datei string emlFilePath = "mail.eml"; using (var ms = new MemoryStream()) using (var smtpClient = new SmtpClient())
-
simo-k 10,495 Reputation points Volunteer Moderator
2025-01-25T01:45:20.49+00:00 Is it a prerequisite for your question to use an external program?
It seems that the new Outlook also supports resending.
<Japanese>
外部プログラムで対応する事が質問の前提条件でしょうか?
新しいOutlookでは再送信にも対応した様です。