C#.NET
string smtpserver = "mail.example.jp";
int port = 25;
string userid = "userid";
string pass = "pass";
System.Net.IPAddress address = System.Net.Dns.GetHostByName(smtpserver).AddressList[0];
TKMP.Net.ISmtpLogon logon ;
logon = new TKMP.Net.AuthCramMd5(userid , pass);
TKMP.Net.SmtpClient smtp = new TKMP.Net.SmtpClient(address , port , logon);
if(!smtp.Connect())
{
System.Windows.Forms.MessageBox.Show("接続失敗");
return ;
}
smtp.Close();
VB.NET
Dim smtpserver As String = "mail.example.jp"
Dim port As Integer = 25
Dim userid As String = "userid"
Dim pass As String = "pass"
Dim address As System.Net.IPAddress = System.Net.Dns.GetHostByName(smtpserver).AddressList(0)
Dim logon As TKMP.Net.ISmtpLogon
logon = New TKMP.Net.AuthCramMd5(userid, pass)
Dim smtp As New TKMP.Net.SmtpClient(address, port, logon)
If Not smtp.Connect() Then
System.Windows.Forms.MessageBox.Show("接続失敗")
Return
End If
smtp.Close()
VB.NETのコードはC#.NETを元に「
C#.NET to VB.NET Translator」によって作成したものです