User-agent: *
Disallow: /admin/
Disallow: /uploads/
Disallow: /config/
Disallow: /mail/
Disallow: /images/
==================================
'Get mail list from serverrDim MailReceiver As QMailClient.POP3Client
MailReceiver = New POP3Client
MailReceiver.RemoteServerAddress = "pop3.163.com"
MailReceiver.UserName = "xxx"
MailReceiver.Password = "yyyy"
'Optional, please set this TRUE when you are under firewall or
'using antivirus software which will scan incoming and outgoing mails.
MailReceiver.IncreaseNetworkCompatible = True
If MailReceiver.Login() = False Then
MessageBox.Show("Login failed", "Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
If Not arrList Is Nothing Then
arrList.Clear()
arrList = MailReceiver.GetMailList(True)
MailReceiver.Quit()
End Iff
'Get a mail from server according to the
'mail index which can be obtained in mail list
Dim MailReceiver As QMailClient.POP3Client
MailReceiver = New POP3Client
MailReceiver.RemoteServerAddress = "pop3.163.com"
MailReceiver.UserName = "xxx"
MailReceiver.Password = "yyyy"
MailReceiver.IncreaseNetworkCompatible = True
Try
MailReceiver.Login()
'Mail Index, it can be obtain from mail list(start from 1)
Mail = MailReceiver.RetrieveMail(MailIndex)
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
MailReceiver.Quit()
End Try
'NOTES: The Retrievemail() method has two overloads which will return
'a QMailClient.EMail object or the source code string of the mail,
'The EMail object can decode the mail automatically and
'support many mail content type such as multipart/mixed,
'multipart/related and multipart/report.
'If you want to use your own mail decoder then just call the overload
'function which only return mail source code (string).
'Show mail on a form or a web page
'NOTES: The code below is not assured to run because it needs some
'form controls, here just show an example.
'The Email.body contains the plain text mail content and the
'Email.bodyHTML contains the source HTML code of the mail
'content if the mail is formatted in HTML
Private Sub ShowMail()
>> Me.lblMailDate.Text = "DATE: " & Mail.Date
>> Me.lblMailFrom.Text = "FROM: " & Mail.From
>> Me.lblMailSubject.Text = "SUBJECT: " & Mail.Subject
>> Me.lblMailTo.Text = "TO: " & Mail.To
>> 'Write a temp file to show HTML mail
>> If Mail.BodyContentType = EMail.ContentType.MultipartAlternative Then
>> Dim file As New FileStream(FolderTmp & "tmp.html", _
FileMode.Create, FileAccess.Write, FileShare.None)
>> Dim a As Encoding = Encoding.GetEncoding("gb2312")
>>
>> file.Write(a.GetBytes(Mail.BodyHTML), 0, _
a.GetByteCount(Mail.BodyHTML))
>> file.Close()
>> Me.rtxtContent.Text = Mail.Body
>> Me.tbtnHTML.Enabled = True
>> ElseIf Mail.BodyContentType = EMail.ContentType.MultipartRelated Then
>> Dim file As New FileStream(FolderTmp & "tmp.html", _
FileMode.Create, FileAccess.Write, FileShare.None)
>> Dim a As Encoding = Encoding.GetEncoding("gb2312")
>>
>> Dim att As MailAttachment
>> Dim strBody As String = Mail.BodyHTML
>> For Each att In Mail.Attachments
>> If att.ContentID <> "" Then
>> strBody = strBody.Replace("cid:" & att.ContentID, _
att.FileName)
>> att.SaveToFile(FolderTmp & att.FileName)
>> End If
>> Next
>>
>> file.Write(a.GetBytes(strBody), 0, a.GetByteCount(strBody))
>> file.Close()
>> Me.rtxtContent.Text = Mail.Body
>> Me.tbtnHTML.Enabled = True
>> Else
>> Me.rtxtContent.Text = Mail.Body
>> Me.tbtnHTML.Enabled = False
>> End If
>>
>> If Mail.Attachments.Count <> 0 Then
>> Dim mailAttach As MailAttachment
>>
>> For Each mailAttach In Mail.Attachments
>> 'Create a empty file in order to get icon
>> Dim strExName As String = _
>> FileInformation.GetFileExtendedName(mailAttach.FileName)
>> Dim strmFile As New _
>> FileStream(FolderTmp & "ico." & strExName, _
>> FileMode.Create)
>> strmFile.Close()
>>
>> Dim fsi As System.IO.FileSystemInfo
>> fsi = New FileInfo(FolderTmp & "ico." & strExName)
>> imgFileIcons.Images.Add(IconExtractor.GetSmallIcon(fsi))
>> lstvAttachments.Items.Add(_
SysInfomation.GetFileNameFromFilePath(_
mailAttach.FileName), _
imgFileIcons.Images.Count - 1)
>> Next
>> Me.grpbxAttach.Visible = True
>> End If
>> End Sub
'Sending a mail
>>>> Dim mailSend As New QMailClient.EMail
'Use ";" to splite multi-receivers
>>>> mailSend.To = "abc@bcd.com;dd@dd.com"
>>>> mailSend.Cc = "cc@dd.com"
>>>> mailSend.Subject = "test"
>>>> mailSend.Body = "test1"
>>>> mailSend.From = "abc@abc.com"
>>>>
>>>> Dim mailClient As New SMTPClient
>>>> mailClient.RemoteServerAddress = "pop3.163.com"
>>>>
>>>> mailClient.IncreaseNetworkCompatible = True
>>>>
>>>> If mailClient.Connect = True Then
>>>>
>>>> mailClient.UserName = "user"
>>>> mailClient.Password = "pass"
>>>>
>>>> If mailClient.AuthLogin = False Then
>>>> MessageBox.Show("Authentication failed", _
"Error", MessageBoxButtons.OK, _
MessageBoxIcon.Error)
>>>>
>>>> Exit Sub
>>>> End If
>>>>
>>>>
>>>> mailClient.SendMail(mailSend)
>>>>
>>>> mailClient.Quit()
>>>>
>>>> mailClient = Nothing
>>>> End If