�w��̃��[���ԍ�(�ϐ���:no)��擾���A�����Ɩ{����\������B ��ق� Attachment �N���X�œY�t�t�@�C����W�J����ꍇ���� text/html �p�[�g��t�@�C���ɕۑ��������ꍇ�A Options.DisableDecodeBodyText() ������� Options.DisableDecodeBodyAll()��Ă�ł���GetMail�Ŏ擾�����w�b�_����і{���f�[�^��g�p����K�v������܂��B using(nMail.Pop3 pop = new nMail.Pop3("mail.example.com")) { try { pop.Connect(); pop.Authenticate("pop3_id", "password"); pop.GetMail(no); MessageBox.Show(String.Format("���[���ԍ�:{0:d} ����:{1:s}\r\n{2:s}", no, pop.Subject, pop.Body)); } catch(nMail.nMailException nex) { MessageBox.Show(String.Format("�G���[ �ԍ�:{0:d} ���b�Z�[�W:{1:s}", nex.ErrorCode, nex.Message)); } catch(Exception ex) { MessageBox.Show(String.Format("�G���[ ���b�Z�[�W:{0:s}", ex.Message)); } }
' VB.NET 2005 �ȍ~�̏ꍇ�AC# �Ɠ��l�� using ���g�p�ł��܂��B Dim pop As nMail.Pop3 = New nMail.Pop3("mail.example.com") Try pop.Connect() pop.Authenticate("pop3_id", "password") pop.GetMail(no) MessageBox.Show(String.Format("���[���ԍ�:{0:d} ����:{1:s}" + ControlChars.CrLf + "{2:s}", no, pop.Subject, pop.Body)) Catch nex As nMail.nMailException MessageBox.Show(String.Format("�G���[ �ԍ�:{0:d} ���b�Z�[�W:{1:s}", nex.ErrorCode, nex.Message)) Catch ex As Exception MessageBox.Show(String.Format("�G���[ ���b�Z�[�W:{0:s}", ex.Message)) Finally pop.Dispose() End Try
SSL Version 3 ��g�p���A�w��̃��[���ԍ�(�ϐ���:no)��擾���A�����Ɩ{����\������B using(nMail.Pop3 pop = new nMail.Pop3("mail.example.com")) { try { pop.SSL = nMail.Pop3.SSL3; pop.Connect(nMail.Pop3.StandardSslPortNo); // over SSL/TLS �̃|�[�g�ԍ���w�肵�Đڑ� pop.Authenticate("pop3_id", "password"); pop.GetMail(no); MessageBox.Show(String.Format("���[���ԍ�:{0:d} ����:{1:s}\r\n{2:s}", no, pop.Subject, pop.Body)); } catch(nMail.nMailException nex) { MessageBox.Show(String.Format("�G���[ �ԍ�:{0:d} ���b�Z�[�W:{1:s}", nex.ErrorCode, nex.Message)); } catch(Exception ex) { MessageBox.Show(String.Format("�G���[ ���b�Z�[�W:{0:s}", ex.Message)); } }
' VB.NET 2005 �ȍ~�̏ꍇ�AC# �Ɠ��l�� using ���g�p�ł��܂��B Dim pop As nMail.Pop3 = New nMail.Pop3("mail.example.com") Try pop.SSL = nMail.Pop3.SSL3 pop.Connect(nMail.Pop3.StandardSslPortNo) ' over SSL/TLS �̃|�[�g�ԍ���w�肵�Đڑ� pop.Authenticate("pop3_id", "password") pop.GetMail(no) MessageBox.Show(String.Format("���[���ԍ�:{0:d} ����:{1:s}" + ControlChars.CrLf + "{2:s}", no, pop.Subject, pop.Body)) Catch nex As nMail.nMailException MessageBox.Show(String.Format("�G���[ �ԍ�:{0:d} ���b�Z�[�W:{1:s}", nex.ErrorCode, nex.Message)) Catch ex As Exception MessageBox.Show(String.Format("�G���[ ���b�Z�[�W:{0:s}", ex.Message)) Finally pop.Dispose() End Try
�w��̃��[���ԍ�(�ϐ���:no)��擾���A�����Ɩ{����\������B�Y�t�t�@�C���� z:\temp �ɕۑ�����B text/html �p�[�g��t�@�C���ɕۑ�����ꍇ�AGetMail �̑O�� Options.EnableSaveHtmlFile() ��Ă�ł����K�v������܂��B �ۑ����� text/html �p�[�g�̃t�@�C������ HtmlFile �Ŏ擾�ł��܂��B using(nMail.Pop3 pop = new nMail.Pop3("mail.example.com")) { try { pop.Connect(); pop.Authenticate("pop3_id", "password"); pop.Path = @"z:\temp"; pop.GetMail(no); MessageBox.Show(String.Format("���[���ԍ�:{0:d} ����:{1:s}\r\n{2:s}", no, pop.Subject, pop.Body)); string [] file_list = pop.GetFileNameList(); if(file_list.Length == 0) { MessageBox.Show("�t�@�C���͂���܂���"); } else { foreach(string name in file_list) { MessageBox.Show(String.Format("�Y�t�t�@�C����:{0:s}", name)); } } } catch(nMail.nMailException nex) { MessageBox.Show(String.Format("�G���[ �ԍ�:{0:d} ���b�Z�[�W:{1:s}", nex.ErrorCode, nex.Message)); } catch(Exception ex) { MessageBox.Show(String.Format("�G���[ ���b�Z�[�W:{0:s}", ex.Message)); } }
' VB.NET 2005 �ȍ~�̏ꍇ�AC# �Ɠ��l�� using ���g�p�ł��܂��B Dim pop As nMail.Pop3 = New nMail.Pop3("mail.example.com") Try pop.Connect() pop.Authenticate("pop3_id", "password") pop.Path = "z:\temp" pop.GetMail(no) MessageBox.Show(String.Format("���[���ԍ�:{0:d} ����:{1:s}" + ControlChars.CrLf + "{2:s}", no, pop.Subject, pop.Body)) Dim file_list As String() = pop.GetFileNameList() If file_list.Length = 0 Then MessageBox.Show("�t�@�C���͂���܂���") Else For Each name As String In file_list MessageBox.Show(String.Format("�Y�t�t�@�C����:{0:s}", name)) Next fno End If Catch nex As nMail.nMailException MessageBox.Show(String.Format("�G���[ �ԍ�:{0:d} ���b�Z�[�W:{1:s}", nex.ErrorCode, nex.Message)) Catch ex As Exception MessageBox.Show(String.Format("�G���[ ���b�Z�[�W:{0:s}", ex.Message)) Finally pop.Dispose() End Try
�ꎞ�x�~�@�\��g���Ďw��̃��[���ԍ�(�ϐ���:no)��擾���A�����Ɩ{����\������B�Y�t�t�@�C���� z:\temp �ɕۑ�����B using(nMail.Pop3 pop = new nMail.Pop3("mail.example.com")) { try { pop.Connect(); pop.Authenticate("pop3_id", "password"); // ���������̋x�~�� int count = pop.GetSize(no) / (nMail.Options.SuspendSize * 1024) + 1; pop.Path = @"z:\temp"; pop.GetMail(no); pop.Flag = nMail.Pop3.SuspendAttachmentFile; pop.GetMail(no); pop.Flag = nMail.Pop3.SuspendNext; while(pop.ErrorCode == nMail.Pop3.ErrorSuspendAttachmentFile) { pop.GetMail(no); // �v���O���X�o�[��i�߂铙�̏��� Application.DoEvents(); } MessageBox.Show(String.Format("���[���ԍ�:{0:d} ����:{1:s}\r\n{2:s}", no, pop.Subject, pop.Body)); string [] file_list = pop.GetFileNameList(); if(file_list.Length == 0) { MessageBox.Show("�t�@�C���͂���܂���"); } else { foreach(string name in file_list) { MessageBox.Show(String.Format("�Y�t�t�@�C����:{0:s}", name)); } } } catch(nMail.nMailException nex) { MessageBox.Show(String.Format("�G���[ �ԍ�:{0:d} ���b�Z�[�W:{1:s}", nex.ErrorCode, nex.Message)); } catch(Exception ex) { MessageBox.Show(String.Format("�G���[ ���b�Z�[�W:{0:s}", ex.Message)); } }
' VB.NET 2005 �ȍ~�̏ꍇ�AC# �Ɠ��l�� using ���g�p�ł��܂��B Dim pop As nMail.Pop3 = New nMail.Pop3("mail.example.com") Try Dim count As Integer pop.Connect() pop.Authenticate("pop3_id", "password") ' ���������̋x�~�� count = pop.GetSize(no) \ (nMail.Options.SuspendSize * 1024) + 1 pop.Path = "z:\temp" pop.Flag = nMail.Pop3.SuspendAttachmentFile pop.GetMail(no) pop.Flag = nMail.Pop3.SuspendNext Do While pop.ErrorCode = nMail.Pop3.ErrorSuspendAttachmentFile pop.GetMail(no) ' �v���O���X�o�[��i�߂铙�̏��� Application.DoEvents() Loop MessageBox.Show(String.Format("���[���ԍ�:{0:d} ����:{1:s}" + ControlChars.CrLf + "{2:s}", no, pop.Subject, pop.Body)) Dim file_list As String() = pop.GetFileNameList() If file_list.Length = 0 Then MessageBox.Show("�t�@�C���͂���܂���") Else For Each name As String In file_list MessageBox.Show(String.Format("�Y�t�t�@�C����:{0:s}", name)) Next fno End If Catch nex As nMail.nMailException MessageBox.Show(String.Format("�G���[ �ԍ�:{0:d} ���b�Z�[�W:{1:s}", nex.ErrorCode, nex.Message)) Catch ex As Exception MessageBox.Show(String.Format("�G���[ ���b�Z�[�W:{0:s}", ex.Message)) Finally pop.Dispose() End Try