najkiie
12-15-2008, 01:10 PM
Hey, im trying to send an email using Visual Basic Express 2008. I alredy have the code but its not working.
This is my code:
Imports System
Imports System.Web.Mail
Public Class Form1
Private Sub send_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles send.Click
Dim server As String
Dim mailto As String
Dim mailfrom As String
Dim subject As String
Dim msg As String
server = "mail.blubbz.com"
mailto = txtto.Text
mailfrom = txtfrom.Text
subject = txtsub.Text
msg = txtmsg.Text & vbNewLine & vbNewLine & "some text here..."
SmtpMail.SmtpServer = server
Try
SmtpMail.Send(mailfrom, mailto, subject, msg)
MsgBox("Email sent sucessfully!")
Catch
MsgBox("An unexpected error accured while sending the email.")
End Try
End Sub
End Class
And this is my program & controls...:
http://img233.imageshack.us/img233/2328/201207picturesz4.jpg
Could anyone please just take a look at the code and tell me whats wrong? The mail server might be wrong, but i dont think thats the problem. Ill talk to my friend about that, he knows the right server.
Please tell me if you find any errors in the code?
Thanks, Nike
Oh come on, no responds? i need this, please!!?
This is my code:
Imports System
Imports System.Web.Mail
Public Class Form1
Private Sub send_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles send.Click
Dim server As String
Dim mailto As String
Dim mailfrom As String
Dim subject As String
Dim msg As String
server = "mail.blubbz.com"
mailto = txtto.Text
mailfrom = txtfrom.Text
subject = txtsub.Text
msg = txtmsg.Text & vbNewLine & vbNewLine & "some text here..."
SmtpMail.SmtpServer = server
Try
SmtpMail.Send(mailfrom, mailto, subject, msg)
MsgBox("Email sent sucessfully!")
Catch
MsgBox("An unexpected error accured while sending the email.")
End Try
End Sub
End Class
And this is my program & controls...:
http://img233.imageshack.us/img233/2328/201207picturesz4.jpg
Could anyone please just take a look at the code and tell me whats wrong? The mail server might be wrong, but i dont think thats the problem. Ill talk to my friend about that, he knows the right server.
Please tell me if you find any errors in the code?
Thanks, Nike
Oh come on, no responds? i need this, please!!?