Thread: Mailing Program
View Single Post
Old Jul 8th, 2007, 1:10 PM   #7
mattireland
Hobbyist Programmer
 
mattireland's Avatar
 
Join Date: Jul 2007
Location: Wales, United Kingdom
Posts: 203
Rep Power: 2 mattireland is on a distinguished road
Send a message via MSN to mattireland Send a message via Skype™ to mattireland
Hey guys! Sorry to invade this thread but why isn't this working?

    Dim sendto = "matt@mattireland.co.uk"

    Private Sub Send1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Send1.Click
        'create the mail message
        Dim mail As New Net.Mail.MailMessage()

        'set the addresses
        mail.From = New Net.Mail.MailAddress("program@program.com")
        mail.To.Add("matt@mattireland.co.uk")

        'set the content
        mail.Subject = "testing"
        mail.Body = "testing program"

        'send the message
        Dim smtp As New Net.Mail.SmtpClient("127.0.0.1")
        smtp.Send(mail)
        MsgBox("The message has been sent to: " & sendto)



    End Sub

I get an unhandled exception error and it says that the sending has failed. Thanks!
__________________
Matt Ireland
http://www.mattireland.org
matt@mattireland.co.uk
mattireland is offline   Reply With Quote