自分の会社の電子メールIDに電子メールを送信することをテストしようとしています。 Exchangeサーバー上にOutlookをホストしています。私は(これは、プライバシー上の理由からランダム1で私の電子メールIDを置き換える)、次のコードを使用します。Web例外が(基になる接続が閉じられました:私はこれを実行するとC#からExchangeに接続する際のSSL/TLSエラー
using System;
using Microsoft.Exchange.WebServices.Data;
namespace TestEmail
{
class Program
{
static void Main(string[] args)
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
service.UseDefaultCredentials = true;
//service.Credentials = new WebCredentials("[email protected]", "password");
service.TraceEnabled = true;
service.TraceFlags = TraceFlags.All;
service.AutodiscoverUrl("[email protected]", RedirectionUrlValidationCallback);
EmailMessage email = new EmailMessage(service);
email.ToRecipients.Add("[email protected]");
email.Subject = "Test mail";
email.Body = new MessageBody("Sending the test email");
email.Send();
}
private static bool RedirectionUrlValidationCallback(string redirectionUrl)
{
// The default for the validation callback is to reject the URL.
bool result = false;
Uri redirectionUri = new Uri(redirectionUrl);
// Validate the contents of the redirection URL. In this simple validation
// callback, the redirection URL is considered valid if it is using HTTPS
// to encrypt the authentication credentials.
if (redirectionUri.Scheme == "https")
{
result = true;
}
return result;
}
}
}
}
、私はAutodiscoverConfigurationに失敗しました」というエラーを取得:)SSL/TLSのセキュリティで保護されたチャネルの信頼関係を確立できませんでした
を、私はそれは別のチームによって処理されるので、Exchange Serverのセキュリティは、私の職場に設定されているかを認識していないですん
方法。この問題は解決しますか?
お返事ありがとうございます! 上記のMicrosoft Remote Connectivityテストを試しましたが、それでも失敗します。 あなたが提案したように、私はExchange管理者から支援を得る必要があると思います。 – doodles
ベストの選択肢でしょうか。必要に応じてExchange AutoDiscoveryプロセス(http://www.admin-enclave.com/en/articles/exchange/267-speed-up-the-exchange-outlook-autodiscovery-process.html)を行うことはできますが、それがあなたの自己作成のアプリケーションのために働くかどうかは分かりません。 – BastianW