R
ryguy7272
I’ve been programming in VBA for a little over 5 years now. I am brand new
to VB.NET and I am trying to learn what I can about this interesting
technology.
I found an example (online) of sending emails through .NET so I tried to
follow the example and get this little app working...I’m really struggling
here...
I went to Control Panel > Add/Remove Programs > Add/Remove Windows
Components > IIS > Details > SMTP (checked). I looked at this video:
In the Video, the instructor is talking about System.Web.dll and
System.Web.Mail, but I can’t find wither of these under my Project > Add
References. I’m working with the same Form, as seen in the video, but my
code is a little different because I couldn’t see some of the code that the
Instructor was working with. I don’t think the problem is necessarily with
the code; somehow I have to get the System.Web.dll…I think.
Anyway, maybe it is the code. Here is what I’m working with:
Imports System.Web
Imports System.Web.Mail.SmtpMail.Send
Public Class Form1
Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSend.Click
Dim mail As New MailMessage()
mail.To = txtTo.Text
mail.From = txtFrom.Text
mail.Subject = txtSubject.Text
mail.Body = txtBody.Text
SmtpMail.SmtpServer = "192.168.2.2" 'your real server goes here
SmtpMail.Send(mail)
MsgBox = ("Message Sent")
Me.Close()
End Sub
End Class
192.168.2.2 is the IP of my laptop. When I hit the ‘Send’ button absolutely
nothing happens. What am I doing worong?
Thanks so much!!
Ryan---
to VB.NET and I am trying to learn what I can about this interesting
technology.
I found an example (online) of sending emails through .NET so I tried to
follow the example and get this little app working...I’m really struggling
here...
I went to Control Panel > Add/Remove Programs > Add/Remove Windows
Components > IIS > Details > SMTP (checked). I looked at this video:
In the Video, the instructor is talking about System.Web.dll and
System.Web.Mail, but I can’t find wither of these under my Project > Add
References. I’m working with the same Form, as seen in the video, but my
code is a little different because I couldn’t see some of the code that the
Instructor was working with. I don’t think the problem is necessarily with
the code; somehow I have to get the System.Web.dll…I think.
Anyway, maybe it is the code. Here is what I’m working with:
Imports System.Web
Imports System.Web.Mail.SmtpMail.Send
Public Class Form1
Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSend.Click
Dim mail As New MailMessage()
mail.To = txtTo.Text
mail.From = txtFrom.Text
mail.Subject = txtSubject.Text
mail.Body = txtBody.Text
SmtpMail.SmtpServer = "192.168.2.2" 'your real server goes here
SmtpMail.Send(mail)
MsgBox = ("Message Sent")
Me.Close()
End Sub
End Class
192.168.2.2 is the IP of my laptop. When I hit the ‘Send’ button absolutely
nothing happens. What am I doing worong?
Thanks so much!!
Ryan---