GrapeCity Secure Mail for .NET 4.0J
プロキシサーバーを介してSMTPサーバーへ接続する

プロキシサーバーを介してSMTPサーバーへ接続するには、Proxyクラスの各種プロパティを設定します。その他の設定や処理は、通常の接続方法と同じです。

  • サンプルコードの先頭にある名前空間の参照文(Visual BasicではImports、C#ではusing)は、ソースファイルの先頭に記述してください。
  • 本トピック以降のサンプルコードでは、サーバー接続設定に関するコードの記載を省略している場合があります。
  • 実際の動作では、本トピックで説明している処理の後、Sendメソッドなどの処理を実行したタイミングで、SMTPサーバーとの通信が開始されます。
Imports Dart.Mail
Imports Dart.Mail.Smtp
    
' 接続するSMTPサーバーとポート番号を指定します。
Smtp1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint("smtp.myMailServer.com", Smtp.GetDefaultPort(Smtp1.Session))
    
' 認証が必要な場合には、ユーザー名とパスワードも設定します。
Smtp1.Session.Username = "myUsername"
Smtp1.Session.Password = "myPassword"
    
' プロキシサーバーのサーバー名とポート番号を指定します。
Smtp1.Session.Proxy.RemoteEndPoint = New Dart.Mail.IPEndPoint("myProxyServer", 80)
    
' 認証が必要な場合には、ユーザー名とパスワードも設定します。
Smtp1.Session.Proxy.Username = "myProxyUsername"
Smtp1.Session.Proxy.Password = "myProxyPassword"
    
' ログイン認証を指定します。
Smtp1.Session.Authentication = Authentication.Login
using Dart.Mail;
using Dart.Mail.Smtp;
    
// 接続するSMTPサーバーとポート番号を指定します。
smtp1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint("smtp.myMailServer.com", Smtp.GetDefaultPort(smtp1.Session));
    
// 認証が必要な場合には、ユーザー名とパスワードも設定します。
smtp1.Session.Username = "myUsername";
smtp1.Session.Password = "myPassword";
    
// プロキシサーバーのサーバー名とポート番号を指定します。
smtp1.Session.Proxy.RemoteEndPoint = new Dart.Mail.IPEndPoint("myProxyServer", 80);
    
// 認証が必要な場合には、ユーザー名とパスワードも設定します。
smtp1.Session.Proxy.Username = "myProxyUsername";
smtp1.Session.Proxy.Password = "myProxyPassword";
    
// ログイン認証を指定します。
smtp1.Session.Authentication = Authentication.Login;

 

 


© 2003, GrapeCity inc. All rights reserved.