We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Email stack in draft

Hi,

I’m trying to send email from my web site using the user credential. My issues at this point is that the email is not sent to the recipient, it’s stack in the draft folder of the sender and I need to provide the user password.

I use the following code:

IEWSClient Iclient = EWSClient.GetEWSClient(“[https://owa.myDomain.com/ews/Exchange.asmx](https://owa.mydomain.com/ews/Exchange.asmx)”, userName, Password);

// Create instance of type MailMessage
Aspose.Email.Mail.MailMessage msg2 = new Aspose.Email.Mail.MailMessage();
msg2.From = userName + "@myDomain.com";
msg2.To = "user1@xxx.com ";
msg2.Subject = “Subject”;
msg2.HtmlBody = “

### Body

”;

Iclient.Send(msg2);

Why my message is stack in ‘userName’ draft folder ? And how to use user Credential?

Hi,


Thank you for contacting Aspose support team.

I have tested your code and found it working fine here. A sample project is attached here for your reference which sends emails successfully. Could you please give it a try a let us know your feedback?

If your problem is not resolved, please send us a complete sample project which can be compiled and executed here for re-producing the issue. This will help us to identify the issue and provide assistance as soon as possible.

Hi,

I used your code and did some changes, this is working:

IEWSClient Iclient = EWSClient.GetEWSClient(“[https://owa.myDomain.com/ews/Exchange.asmx](https://owa.mydomain.com/ews/Exchange.asmx)”, “userName”, “Password”);

I do not want users to have to enter their user name and password every time they send an email. I would like to do something like:

IEWSClient Iclient = EWSClient.GetEWSClient(“[https://owa.myDomain.com/ews/Exchange.asmx](https://owa.mydomain.com/ews/Exchange.asmx)”, System.Net.CredentialCache.DefaultNetworkCredentials);

but this return the error message:
“Mailbox information can not be read. at .Ÿ•.GetMailboxInfo(String mailbox, ˜& mailboxInfo, Int64& mailboxSize, ServerVersionInfo& serverVersion) at .Ÿ•.GetMailboxInfo() at .Ÿ•…ctor(String , ICredentials , WebProxy ) at Aspose.Email.Exchange.EWSClient.GetEWSClient(String mailboxUri, ICredentials credentials, WebProxy proxy)…”

Do I need to do any change on the exchange server?
I am using MVC .NET Framework 4 with ‘Windows’ authentication.

Thanks for your help.

Hi,


Could you please make sure that:

  1. You are logged in as a domain user
  2. The System.Net.CredentialCache.DefaultNetworkCredentails contain the proper information in all available fields
Also, it may be that the DefaultNetworkCredentails may already be filled with credentials from previous successful authentication.

"The credentials returned by the DefaultNetworkCredentials property is applicable only for NTLM, negotiate, and Kerberos-based authentication.
The credentials returned by DefaultNetworkCredentials represents the authentication credentials for the current security context in which the application is running. For a client-side application, these are usually the Windows credentials (user name, password, and domain) of the user running the application. For ASP.NET applications, the default network credentials are the user credentials of the logged-in user, or the user being impersonated."

Please let us know your feedback for further assistance in this regard.