How to send results back to myself? RRS feed

  • Question

  • I'm new to visual studio and I made a small program and for the part I'm making now (people signing up for the program) I want to send the email addresses they put in back to myself so I can send out confirmation emails and I was wondering how I can send info back to myself. Thanks. I hope I don't sound like a spammer but I'm not lol.
    Tuesday, March 15, 2016 1:00 AM


  • Hi,

    This is a sample (VB.NET) I'm using (of course, some strings, numbers are modified).
    Please modify them for yourself.
    Imports System.Net.Mail			' -- WebClient class(for sending mail)
    Imports System.Net				' -- WebClient class(for sending mail)
    Imports System.Text				' -- for mail Encoding
    Public Class cls_SendMail
    	Inherits (some parent)
    	Public Sub prc_Send_Mail()
    		Dim mailMsg As New MailMessage()
    		Dim SMTPclient As New SmtpClient()
    		' === Mail ====================================================
    		With frm_Main
    			mailMsg.From = New MailAddress("name@domain", "diaplay name")
    			mailMsg.Priority = MailPriority.High
    			mailMsg.Subject = "something mail subject"
    			mailMsg.Body = "mail body text"
    			mailMsg.IsBodyHtml = False	' -- plain text (not HTML)
    		End With
    		' === SMTP ====================================================
    		' -- Connecting to the server and configuring it
    		SMTPclient.Host = ""
    		SMTPclient.Port = 999
            SMTPclient.EnableSsl = True
    		SMTPclient.DeliveryMethod = SmtpDeliveryMethod.Network
    		SMTPclient.UseDefaultCredentials = False
    		SMTPclient.Credentials = New NetworkCredential("mail address for credential", "password")
    		SMTPclient.Timeout = 999
    			SMTPclient.Send(mailMsg)    '  -- send mail asynchronous
    		End Try
    	End Sub
    End Class
    Tuesday, March 15, 2016 11:06 AM