Sending email using Exchange server and authentication
I need to send emails using an Exchange server which required authentication. Anyone can help me?
I've read several things about sending emails using SMTP (with System.Net.Mail) and none of those seem to work :D (SMTP and Exchange? I dont even know the relation)
help! :afrog:
Re: Sending email using Exchange server and authentication
This is a shot in the dark but try using System.Net.Sockets and System.Net.Security namespace, maybe you need to use the Authentica in the SSLStream somehow...
Code:
private TcpClient oTcpClient;
private SslStream oSslStream;
try
{
// Attempt to connect to the remote server.
oTcpClient = new TcpClient(m_Server, m_Port);
oSslStream = new SslStream(oTcpClient.GetStream());
oSslStream.AuthenticateAsClient(m_Server);
}
catch(Exception e)
{
System.Diagnostics.Debug.WriteLine(e.Message);
}