Try

                Dim mail As New MailMessage
            mail.To = "wqiyuan@126.com"
            mail.From = "qi@126.com"
            ' mail.
            '  mail.From.

            mail.Subject = "progToemail11"

            mail.BodyFormat = MailFormat.Html
            mail.Body = "qiyuan123"


            '******************************
            Dim sFile As String = "E:\he.rar"

            Dim oAttch As MailAttachment = New MailAttachment(sFile, MailEncoding.Base64)

            mail.Attachments.Add(oAttch)     附件   
            '******************************
            mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
            mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "username")
            mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password")
            SmtpMail.SmtpServer = "smtp126.com"
            SmtpMail.Send(mail)


            MessageBox.Show("发送邮件成功", "qiyuan")
        Catch ex As Exception

            MessageBox.Show(ex.ToString)


        End Try

相关文章:

  • 2021-10-18
  • 2021-07-19
  • 2021-08-25
  • 2021-05-27
猜你喜欢
  • 2022-03-01
  • 2021-08-02
  • 2022-12-23
  • 2022-03-10
  • 2021-09-08
相关资源
相似解决方案