Jump to content

VB Email Sender

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
VBnet

VBnet

    Newbie

  • Members
  • PipPip
  • 18 posts
Hello CodeCallMembers, today i will be showing you how to make a email sender

You need: 1 Textbox, and 2 Buttons/Command Buttons


First Step: Drag and drop a button, name it "send", double click it and add:
Dim smtpServer As New SmtpClient()

        Dim mail As New MailMessage()

        smtpServer.Credentials = New Net.NetworkCredential("[COLOR="Red"][COLOR="Lime"]fertyl5@gmail.com[/COLOR][/COLOR]", "[COLOR="Lime"]fertyl200[/COLOR]")

        'using gmail

        smtpServer.Port = 587

        smtpServer.Host = "smtp.gmail.com"

        smtpServer.EnableSsl = True

        mail = New MailMessage()

        mail.From = New MailAddress("fertyl5@gmail.com")

        mail.To.Add("[COLOR="Red"]admin@gamerschannel.net[/COLOR]")

        mail.Subject = ("[COLOR="Lime"]change to whatever you want[/COLOR]")

        mail.Body = TextBox1.Text

        smtpServer.Send(mail)

        MsgBox("[COLOR="Red"]Mail Sent Succesfull![/COLOR]")

Everything that ive marked with red, you need to change thoose, if i marked Green, it is not necesery.

You dont need to change "fertyl5@gmail.com" and "fertyl200" because you dont wanna rewrite the code, this is much easier! You can change them if you want!
"admin@gamerschannel.net", change that to your email, so when they click "send" the info will be sent to you!

Now to the second button, name it Cancel and add:
Code:
End

Then, when you are done with the both buttons, and without no errors
take a textbox, make it long so pepole can write in it!

Then take this code:
Code:
imports system.net.Mail
put it over

Public Class Form1

when you have done that, you are done! Reply if you didnt understand, and i wouldnt mind if someone +rep:ed me

Bye Bye:rolleyes:

#2
egoist

egoist

    Newbie

  • Members
  • Pip
  • 1 posts
How to determine the email to send to and how to determine the subject and its says there is problem in ""smtpServer.Send(mail)
""