I have this code that I used a long time before. This is a class to send an e-mail throught VB.NET
==========================================================
Imports System.Web.Mail
Public Class SendMail
Private emailID As String, thisBody As String, thisSubject As String
Private fromAddr as String, Smtp As SmtpMail
'======================================================= ' Create a new E-Mail object taking the input parameters:
' toAddr -> E-Mail ID to send the mail to
' fromAddr -> From E-Mail address
' body -> Body of the email as string
' subj -> Subject as string
'======================================================= Public Sub New(ByVal to As String, ByVal from As String, ByVal body As String, ByVal subj As String)
emailID = to
thisBody = body
thisSubject = subj
fromAddr = from
Smtp.SmtpServer = "" ' SMTP server address here
End Sub
'=======================================================
' Send the E-Mail
'=======================================================
Public Function Send()
Dim msg As MailMessage = New MailMessage
msg.Body = thisBody
msg.From = fromAddr
msg.To = emailID
msg.Subject = thisSubject
Smtp.Send(msg)
End Function
End Class
==========================================================
In your case, you can use it this way:
dim mymail as New SendMail("to@mail.com", "from@mail.com", strOutput, "sample mail")
mymail.Send()
SJ.
---------------------------
joe_pool_is said:
We have a basic form online, and we are collecting info with vb.net and asp.net into a string called strOutput.
We would like to have this string sent to us in an email, but no one knows how to do that once the button Submit is pressed.
Any thoughts? Links?