Send Email using Office 365 exchange in ASP.Net Visual Studio RRS feed

  • Question

  • I want to send and save emails from our intranet based CRM. We are using Visual Studio 2017 Enterprise edition. Following is the code I am using to send email through exchange Office 365. In this, I have to pass the password in plain text to provide credentials all the time. 

    My question is "Is there any other way I can send and save email using Exchange Web Service without passing password?"

    Because I have to store this password for every single user when they want to send email! And I do not want to store passwords on SQL server or in memory!!!

      var service = new Microsoft.Exchange.WebServices.Data.ExchangeService(Microsoft.Exchange.WebServices.Data.ExchangeVersion.Exchange2013_SP1);
                                string fromAddress = Security.EXCHANGE_EMAIL; 
                                string fromPassword = Security.Password;
                                service.Credentials = new Microsoft.Exchange.WebServices.Data.WebCredentials(fromAddress, fromPassword);
                                service.TraceEnabled = false;
                                service.EnableScpLookup = true;
                                service.Url = new Uri("https://outlook.office365.com/ews/exchange.asmx");
                                Microsoft.Exchange.WebServices.Data.Appointment appointment = new Microsoft.Exchange.WebServices.Data.Appointment(service);

    Tuesday, April 10, 2018 2:11 PM

All replies

  • Hi Saj7861,

    Welcome to the MSDN forum.

    It seems your issue is about the ASP.NET development and our forum is to discuss the VS IDE, please redirect to this appropriate forum: https://forums.asp.net/ and start a new thread to seek for a better support, thank you for your understanding.

    Best regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Wednesday, April 11, 2018 6:00 AM