Man, that works great! I just converted it to VB.NET and also showed the
Imports
/
Using
that was needed, thanks to David's alternate. This was just what I was looking for, Thanks Abdur.
Imports System.Net
Imports System.Net.Mail
Public Class frmMain
Private Sub frmMain_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub BtnSend_Click(sender As System.Object, e As System.EventArgs) Handles btnSend.Click
Dim MailFrom As MailAddress = New MailAddress("YourName@Gmail.com")
Dim MailTo As MailAddress = New MailAddress("TheirName@Gmail.com")
Dim NewMsg As MailMessage = New MailMessage(MailFrom, MailTo)
NewMsg.Subject = "Test From VB.Net"
NewMsg.Body = "Ok, Did I translate from C# to VB?"
Dim Att As Attachment = New Attachment("c:\\Picture.jpg")
NewMsg.Attachments.Add(Att)
Dim Smtp As SmtpClient = New SmtpClient("smtp.gmail.com", 587)
Smtp.UseDefaultCredentials = False
Smtp.Credentials = New NetworkCredential("YourName@gmail.com", "YourPassword")
Smtp.EnableSsl = True
Smtp.Send(NewMsg)
End Sub
End Class