''' <summary>
''' 邮箱代码
''' </summary>
''' <param name="toaddress">收件人地址</param>
''' <param name="toname">收件人名字</param>
''' <param name="caosongren">抄送人</param>
''' <param name="mimiren">密件抄送人</param>
''' <param name="subject">主题</param>
''' <param name="body">正文</param>
''' <returns> 不返回</returns>
''' <remarks></remarks>
Public Shared Sub senderemail(ByVal toaddress As String, ByVal toname As String, ByVal caosongren As String, ByVal mimiren As String, ByVal subject As String, ByVal body As String)
Dim client As SmtpClient = New SmtpClient("smtp.163.com")
client.Host = "smtp.163.com"
'client.Port="端口"
client.UseDefaultCredentials = False
client.Credentials = New System.Net.NetworkCredential("xxxxx@163.com", "密码")
client.DeliveryMethod = SmtpDeliveryMethod.Network
Dim addressfrom As MailAddress = New MailAddress("xxxxx@163.com", "我是test")
Dim addressto As MailAddress = New MailAddress(toaddress, toname)
Dim messages As MailMessage = New MailMessage(addressfrom, addressto)
Dim cc As MailAddress = New MailAddress(caosongren) '抄送人
messages.CC.Add(cc)
Dim mim As MailAddress = New MailAddress(mimiren) '密人
messages.Bcc.Add(mim)
messages.Priority = MailPriority.High
messages.Body = body
messages.Subject = subject
messages.BodyEncoding = System.Text.Encoding.UTF8
messages.IsBodyHtml = True
Try
client.Send(messages)
Catch ex As Exception
Throw ex
End Try
End Sub