You must Sign In to post a response.
  • Category: ASP.NET

    Out look sent item in sentmail

    Hello team,
    I have sent a mail through outlook by asp.net code. This mail is going to destination EmailID but I am not able to see it in sent item folder of Outlook.




    MailMessage Msg = new MailMessage();


    Msg.From = new MailAddress("From email");

    Msg.To.Add(txtemail.Text.Trim());

    Msg.Subject = txtsubject.Text.Trim();

    Msg.Body = txtmessage.Text.Trim();

    Msg.IsBodyHtml = true;

    SmtpClient smtp = new SmtpClient();

    //smtp.Host = "smtp.gmail.com";
    smtp.Host = "outlook host";

    System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();

    NetworkCred.UserName = "senderemail";

    NetworkCred.Password = "password";



    smtp.UseDefaultCredentials = true;

    smtp.Credentials = NetworkCred;

    smtp.Port = 587;
    smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
    smtp.EnableSsl = true;

    smtp.Send(Msg);


    How I can get all item in my Sent folder in outlook.

    Thanks
    Navneet
  • #761047
    Hi

    You can go through Below link for Outlook sent mail concept

    http://www.codeproject.com/Articles/700211/Csharp-SMTP-Configuration-for-Outlook-Com-SMTP-Hos

    http://www.c-sharpcorner.com/UploadFile/abhikumarvatsa/sending-and-receiving-emails-from-ms-outlook-in-VB-Net/

    http://www.csharpque.com/2012/05/send-mail-using-microsoft-outlook.html

    http://www.codeproject.com/Tips/165548/C-Code-snippet-to-send-an-Email-with-attachment-fr

    http://www.c-sharpcorner.com/UploadFile/casperboekhoudt/SendingEmailsThroughOutlook12052005000124AM/SendingEmailsThroughOutlook.aspx

    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #761056

    Hello Navneet,

    Refer the below code :

    using Microsoft.Office.Interop.Outlook;

    try
    {
    // Create a Outlook Application and connect to outlook
    Application OutlookApplication = new Application();

    // create the MailItem which we want to send
    MailItem message = (MailItem)OutlookApplication.CreateItem(OlItemType.olMailItem);

    MailAddress toAddress = new MailAddress("tomail@domain.com");
    MailAddress ccAddress = new MailAddress("ccmail@domain.com");

    message.To = toAddress.ToString();
    message.CC = ccAddress.ToString();
    message.Subject = "Mail Subject";
    message.Body = "Mail Body";
    message.BodyFormat = OlBodyFormat.olFormatHTML;

    //Send email
    message.Send();
    // Show success message
    }
    catch (System.Exception ex)
    {
    // Show error message
    }

    Hope this will help you.


    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • #761129
    Usually the sent item wont be seen in sent item folder. i am not going to tell the technical reasons, just some practical thoughts.

    1. Usually we are making websites that is hosted somewhere and can be access through internet or intranet.
    2. When we are doing the same, we cant make sure that the client machine is configured with the sending mail id, so that it is suppose to come on the sent items of client machine.
    3. there are chances that we are masking the mail id and sending.
    4. what i usually do is sent a cc or bcc of the mail to a mail id configured in the web config

    or

    we can copy the html content of the mail to db

    NB: there can be chances that it will come to sent folder, if the mail id is not set, u need to handle the exception

    Do Good... Enjoy your life.....

  • #761148
    Hai Navneet,
    To do this, you need to use the Outlook API and then you need to connect the outlook with the application and then you can get the emails in the Sent Item folder of the outlook.
    Sent Item is an special folder which is inbuilt for the outlook, so to get the message from this folder, you need to use "MAPI" API, which is the OS based.
    Below is a link where you can find the code which can be used to connect with the Outlook using MAPI:

    https://www.add-in-express.com/creating-addins-blog/2014/01/09/outlook-special-folders/

    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com


Sign In to post your comments