It would be difficult to hold liability a third party (both pasting code to them, and if something went wrong/warranty issues), so for this application we will push through a request to convert if by hand.
Recently I was creating a addin for my outlook where I added a new button on my outlook toolbar for sending mails. I am opening a compose form designed by me and when user clicks on send button I am running the below logic for sending mails out.
public class OutlookDotComMail
string _sender = "";
string _password = "";
public OutlookDotComMail(string sender, string password)
_sender = sender;
_password = password;
public void SendMail(string recipient, string subject, string message)
SmtpClient client = new SmtpClient("smtp-mail.outlook.com");
var mail = new MailMessage(_sender.Trim(), recipient.Trim());
mail.Subject = subject;
mail.Body = message;
catch (Exception ex)
My mail is being successfully delivered to the recepients but I am not able to see the sent mail in my outlook sent mails folder after sending it.
Can anyone suggest me a solution for this problem.?
Thanks in advance.
Ummm.... you say you're writing an Outlook add-in but when you send an email you're sending it using the methods built into the .NET Framework, NOT IN OUTLOOK! You're also using an outside SMTP server, called smtp-mail.outlook.com, which has nothing to do with the Outlook that you're writing an add-in for.
It's no wonder that the mail you sent doesn't show up in the users Sent Items folder. You never used Outlook to send it!
Thanks for the reply.Actually I am using the same smtp server that my outlook has been configured to.My outlook outgoing server is same as that I used in my code.
You have suggested to use outlook mail item object for sending mails but I need to change the sender from address which is not possible if I use outlook mail object.
Is there a way figure it out?
OK, so you're sending the mail as someone else using an outside service provider. Outside SMTP servers doesn't provide any "sent mail" tracking folders. SMTP only sends a mail message and then forgets about it. If you want a Sent Mail copy your application has to track that. The SMTP server doesn't have any facility for that.
How does Outlook.com do it?? It saves a copy of the mail message in an application folder after the mail is successfully sent using SMTP. The application does it, not the SMTP server.
So, YOUR CODE has to save a copy of the mail message in Outlook. You cannot depend on an outside provider to provide that service for you.
What's a JSON string? It is a representation of a serialized object.
What's a Datagrid? It is a UI element for showing data.
What have you to do now? Deserialize the JSON string to get the object. Define how to bind the object to the Datagrid. Then do it.