Its really simple, and then i mean.. simple
Start by Creating a new Window Forms Application
When you have done that, you will have a blank form, Double click the form so the coding page shows and add the folowing code over Public Class Form1
Imports System.Net.Mail
When you have done that and you have no errors, continue.
Okey, so we will need 4 textboxes and 4 labels + one button
Lets start with the first one!
Add one Textbox and a Label, rename the label to "From" and place the textbox right after it
then take the second textbox and the second label, rename it to "To" and place the textbox right after the label.
Now place the third textbox and the third label, rename it to "Subject"
Now at last, place the fourth textbox and the fourth label, rename the label to "Text" or "Enter message here". Make the fourth textbox multi line
Now just add one button, change the text to "Send"
Here Starts coding----------------------------------
Okey, double click the button and add the folowing code:
Dim smtpServer As New SmtpClient()
Dim mail As New MailMessage()
smtpServer.Credentials = New Net.NetworkCredential("killerdwrf@gmail.com", "wertyl11")
'using Gmail
smtpServer.Port = 587
smtpServer.Host = "smtp.gmail.com"
smtpServer.EnableSsl = True
mail = New MailMessage()
mail.From = New MailAddress("killerdwrf@gmail.com" , textbox1.text)
mail.To.Add(textbox2.text)
mail.Subject = textbox3.text
mail.Body = textbox4.text
smtpServer.Send(mail)
where it stands "("killerdwrf@gmail.com", "wertyl11")", you can ignore them, only change them if you dont wanna use my gmail account, remember this is not necessary!
Coding ends here ----------------------------------
Now debug your program, it you have any problems, please post them on the thread
Please say thanks if this works!
I am new here, and please ignore my spelling mistakes


Sign In
Create Account

Back to top









