"send email from vb.net" Code Answer's
You're definitely familiar with the best coding language VBA that developers use to develop their projects and they get all their queries like "send email from vb.net" answered properly. Developers are finding an appropriate answer about send email from vb.net related to the VBA coding language. By visiting this online portal developers get answers concerning VBA codes question like send email from vb.net. Enter your desired code related query in the search bar and get every piece of information about VBA code related question on send email from vb.net.
send email from vb.net
'You will need the following tools:
'5 textboxes (txtFrom, txtPass, txtTo, txtSubject, txtMessage)
'5 labels (labelling each of the text boxes)
'2 buttons (btnSend, btnExit)
Imports System.Net.Mail
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
txtPass.PasswordChar = Chr(149)
End Sub
Private Sub btnSend_Click(sender As Object, e As EventArgs) Handles btnSend.Click
Try
Dim mail As New MailMessage
'this program will send an email to another user via Outlook
'as shown below
Dim smtpServer As New SmtpClient("smtp.outlook.com")
'you can change 'outlook' with another email sending website, such as Gmail
mail.From = New MailAddress(txtFrom.Text)
mail.To.Add(txtTo.Text)
mail.Subject = txtSubject.Text
mail.Body = txtMessage.Text
'checking the user's details
smtpServer.Port = 587
smtpServer.Credentials = New System.Net.NetworkCredential(txtFrom.Text, txtPass.Text)
smtpServer.EnableSsl = True
smtpServer.Send(mail)
'confirmation message to the user
MsgBox("Your email has been sent", MessageBoxIcon.Information, MessageBoxButtons.OK)
Catch ex As Exception
MsgBox(ex.Message, vbCritical)
End Try
End Sub
'exit button
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class
All those coders who are working on the VBA based application and are stuck on send email from vb.net can get a collection of related answers to their query. Programmers need to enter their query on send email from vb.net related to VBA code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about send email from vb.net for the programmers working on VBA code while coding their module. Coders are also allowed to rectify already present answers of send email from vb.net while working on the VBA language code. Developers can add up suggestions if they deem fit any other answer relating to "send email from vb.net". Visit this developer's friendly online web community, CodeProZone, and get your queries like send email from vb.net resolved professionally and stay updated to the latest VBA updates.