C#.NET
string server = "mail.example.jp";
int port = 110;
string userid = "userid";
string pass = "pass";
bool apop = true;
System.Net.IPAddress address = System.Net.Dns.GetHostByName(server).AddressList[0];
TKMP.Net.IPopLogon logon;
if(apop)
{
logon = new TKMP.Net.APopLogon(userid , pass);
}
else
{
logon = new TKMP.Net.BasicPopLogon(userid , pass);
}
TKMP.Net.PopClient pop = new TKMP.Net.PopClient(logon , address , port);
if(pop.Connect())
{
System.Windows.Forms.MessageBox.Show("接続失敗");
}
else
{
System.Windows.Forms.MessageBox.Show("接続成功");
}
pop.Close();
VB.NET
Dim server As String = "mail.example.jp"
Dim port As Integer = 110
Dim userid As String = "userid"
Dim pass As String = "pass"
Dim apop As Boolean = True
Dim address As System.Net.IPAddress = System.Net.Dns.GetHostByName(server).AddressList(0)
Dim logon As TKMP.Net.IPopLogon
If apop Then
logon = New TKMP.Net.APopLogon(userid, pass)
Else
logon = New TKMP.Net.BasicPopLogon(userid, pass)
End If
Dim pop As New TKMP.Net.PopClient(logon, address, port)
If pop.Connect() Then
System.Windows.Forms.MessageBox.Show("接続成功")
Else
System.Windows.Forms.MessageBox.Show("接続失敗")
End If
pop.Close()
VB.NETのコードはC#.NETを元に「
C#.NET to VB.NET Translator」によって作成したものです