MailFormat.Html : MailFormat « System.Web.Mail « VB.Net by API





MailFormat.Html

   
Imports System.Web.Mail
Imports System.Web.Mail.MailMessage
Imports System.Web.Mail.MailAttachment
Imports System.Web.Mail.SmtpMail
Imports System.IO
Imports System.Text
Imports System.Text.Encoding
Imports System.Threading


Public Class Tester
    Public Shared Sub Main
        Dim mailmsg As System.Web.Mail.MailMessage
        Dim mailAttach As System.Web.Mail.MailAttachment
        Dim i As Integer
    
        Try
          SmtpMail.SmtpServer = "server"
          mailmsg = New MailMessage()
          mailmsg.From = "from@from.net"
          mailmsg.To = "to@to.net"
          mailmsg.Cc = "cc@cc.net"
          mailmsg.Bcc = "bcc@bcc.net"
          mailmsg.Subject = "sub"
    
          mailmsg.BodyEncoding = System.Text.Encoding.UTF8
    
          mailmsg.Body = "body"
    
          mailmsg.BodyFormat = MailFormat.Html
          'mailmsg.BodyFormat = MailFormat.Text
    
          mailAttach = New MailAttachment("c:test.txt")
          mailmsg.Attachments.Add(mailAttach)
    
          mailmsg.Priority = MailPriority.Normal
          mailmsg.Priority = MailPriority.Low
          mailmsg.Priority = MailPriority.High
    
          Dim CurThread As Thread
    
          CurThread = System.Threading.Thread.CurrentThread
    
          SyncLock CurThread
            SmtpMail.Send(mailmsg)
          End SyncLock
    
          mailmsg = Nothing
    
          Console.WriteLine("Send Mail Successfully.")
    
        Catch ex As Exception
          Console.WriteLine("Send Mail Error: " & ex.ToString)
        End Try
    
    End Sub

End Class

   
    
    
  










Related examples in the same category