I would like to send emails from an application running on an application server through Microsoft Exchange which is on another network.
This message was posted using Email2Forum by Tahir Manzoor.
I would like to send emails from an application running on an application server through Microsoft Exchange which is on another network.
Hi Jason,
<span style=“font-size:9.0pt;font-family:“Courier New”;
mso-fareast-font-family:“Times New Roman”;color:gray”>// Create instance of
ExchangeClient class by giving credentials<o:p></o:p>
ExchangeClient client = new ExchangeClient("http://MachineName/exchange/username",
"username", "password", "domain");
// Create instance of type MailMessage
MailMessage msg = new MailMessage();
msg.From = "sender@domain.com";
msg.To = "recipient@ domain.com ";
msg.Subject = "Sending message from exchange server";
msg.HtmlBody = "sending message from exchange
server
";
// Send the message
client.Send(msg);
Working with Exchange Web Service (EWS)
For Exchange Server 2007 and above with EWS, you can use our IEWSCleint for sending email as shown in the following sample code:
// Create instance of IEWSClient class by giving credentials
IEWSClient client = EWSClient.GetEWSClient("https://outlook.office365.com/ews/exchange.asmx", "testUser", "pwd", "domain");
// Create instance of type MailMessage
MailMessage msg = new MailMessage();
msg.From = "sender@domain.com";
msg.To = "recipient@ domain.com ";
msg.Subject = "Sending message from exchange server";
msg.HtmlBody = "sending message from exchange server
";
// Send the message
client.Send(msg);
Please feel free to write to us if you have any further query/inquiry in this regard. We'll be glad to assist you further.
Hi Kashif
Thanks for the info… I am testing with Exchange 2010 but want a solution for all from 2007.
Using your code snippet I get a variety of different responses depending on the uri used:
IEWSClient client = EWSClient.GetEWSClient(“https:[//outlook.office365.com/ews/exchange.asmx](https://outlook.office365.com/ews/exchange.asmx)”, “testUser”, “pwd”, “domain”);
Internal address: https://cpt.companyname.com/owa/
Response = The request failed with HTTP status 440: Login Timeout.
External address: https://exchange.companyname.com/owa
:
Response = The request failed with an empty response.
I am sure the username, password and domain fields are correct.
Do you have any suggestions on how I can get this to work with Aspose Emails?
Thanks
Jason
Hi Jason,
Hi Kashif
Hi Jason,