VS 2005 - XP media - VB .net - winforms - .net 2.0
Just trying to send an email, here is the code and the error message that I
get. I can't figure out how to fix it?
'create the mail message
Dim mail As New MailMessage()
Dim smtp As New SmtpClient("htt p://mail.Someplace. com")
Dim WhatTimeIsIt As DateTime
mail.From = New MailAddress("To ny@Someplace.co m")
mail.To.Add("To nyMast@Someplac e.com")
WhatTimeIsIt = DateTime.Now
mail.Subject = "This is an email" & Format(WhatTime IsIt) & " - "
& " winforms"
mail.Body = "this is a sample body"
'This next line didn't help error but i was getting error prior to putting
this line in.
smtp.Credential s = New Net.NetworkCred ential("Usernam e", "Secrete")
smtp.Send(mail)
-----------------Error Message -----------------------
System.Net.Mail .SmtpException was unhandled
Message="Failur e sending mail."
Source="System"
StackTrace:
at System.Net.Mail .SmtpClient.Sen d(MailMessage message)
at WinformsEMailte st.Form1.Button 1_Click(Object sender, EventArgs e)
in C:\AllUserFiles \Movies\Winform sEMailtest\Winf ormsEMailtest\F orm1.vb:line
28
at System.Windows. Forms.Control.O nClick(EventArg s e)
at System.Windows. Forms.Button.On Click(EventArgs e)
at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent)
at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons
button, Int32 clicks)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)
at System.Windows. Forms.Button.Wn dProc(Message& m)
at
System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
at System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage&
m)
at System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows. Forms.UnsafeNat iveMethods.Disp atchMessageW(MS G&
msg)
at
System.Windows. Forms.Applicati on.ComponentMan ager.System.Win dows.Forms.Unsa feNativeMethods .IMsoComponentM anager.FPushMes sageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo pInner(Int32
reason, ApplicationCont ext context)
at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo p(Int32 reason,
ApplicationCont ext context)
at System.Windows. Forms.Applicati on.Run(Applicat ionContext context)
at
Microsoft.Visua lBasic.Applicat ionServices.Win dowsFormsApplic ationBase.OnRun ()
at
Microsoft.Visua lBasic.Applicat ionServices.Win dowsFormsApplic ationBase.DoApp licationModel()
at
Microsoft.Visua lBasic.Applicat ionServices.Win dowsFormsApplic ationBase.Run(S tring[]
commandLine)
at WinformsEMailte st.My.MyApplica tion.Main(Strin g[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.v b:line 81
at System.AppDomai n.nExecuteAssem bly(Assembly assembly, String[]
args)
at System.AppDomai n.ExecuteAssemb ly(String assemblyFile, Evidence
assemblySecurit y, String[] args)
at Microsoft.Visua lStudio.Hosting Process.HostPro c.RunUsersAssem bly()
at System.Threadin g.ThreadHelper. ThreadStart_Con text(Object state)
at System.Threadin g.ExecutionCont ext.Run(Executi onContext
executionContex t, ContextCallback callback, Object state)
at System.Threadin g.ThreadHelper. ThreadStart()
------------------------------------------------------------------------------------------------------------------------------------------------------
Just trying to send an email, here is the code and the error message that I
get. I can't figure out how to fix it?
'create the mail message
Dim mail As New MailMessage()
Dim smtp As New SmtpClient("htt p://mail.Someplace. com")
Dim WhatTimeIsIt As DateTime
mail.From = New MailAddress("To ny@Someplace.co m")
mail.To.Add("To nyMast@Someplac e.com")
WhatTimeIsIt = DateTime.Now
mail.Subject = "This is an email" & Format(WhatTime IsIt) & " - "
& " winforms"
mail.Body = "this is a sample body"
'This next line didn't help error but i was getting error prior to putting
this line in.
smtp.Credential s = New Net.NetworkCred ential("Usernam e", "Secrete")
smtp.Send(mail)
-----------------Error Message -----------------------
System.Net.Mail .SmtpException was unhandled
Message="Failur e sending mail."
Source="System"
StackTrace:
at System.Net.Mail .SmtpClient.Sen d(MailMessage message)
at WinformsEMailte st.Form1.Button 1_Click(Object sender, EventArgs e)
in C:\AllUserFiles \Movies\Winform sEMailtest\Winf ormsEMailtest\F orm1.vb:line
28
at System.Windows. Forms.Control.O nClick(EventArg s e)
at System.Windows. Forms.Button.On Click(EventArgs e)
at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent)
at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons
button, Int32 clicks)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)
at System.Windows. Forms.Button.Wn dProc(Message& m)
at
System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
at System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage&
m)
at System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows. Forms.UnsafeNat iveMethods.Disp atchMessageW(MS G&
msg)
at
System.Windows. Forms.Applicati on.ComponentMan ager.System.Win dows.Forms.Unsa feNativeMethods .IMsoComponentM anager.FPushMes sageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo pInner(Int32
reason, ApplicationCont ext context)
at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo p(Int32 reason,
ApplicationCont ext context)
at System.Windows. Forms.Applicati on.Run(Applicat ionContext context)
at
Microsoft.Visua lBasic.Applicat ionServices.Win dowsFormsApplic ationBase.OnRun ()
at
Microsoft.Visua lBasic.Applicat ionServices.Win dowsFormsApplic ationBase.DoApp licationModel()
at
Microsoft.Visua lBasic.Applicat ionServices.Win dowsFormsApplic ationBase.Run(S tring[]
commandLine)
at WinformsEMailte st.My.MyApplica tion.Main(Strin g[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.v b:line 81
at System.AppDomai n.nExecuteAssem bly(Assembly assembly, String[]
args)
at System.AppDomai n.ExecuteAssemb ly(String assemblyFile, Evidence
assemblySecurit y, String[] args)
at Microsoft.Visua lStudio.Hosting Process.HostPro c.RunUsersAssem bly()
at System.Threadin g.ThreadHelper. ThreadStart_Con text(Object state)
at System.Threadin g.ExecutionCont ext.Run(Executi onContext
executionContex t, ContextCallback callback, Object state)
at System.Threadin g.ThreadHelper. ThreadStart()
------------------------------------------------------------------------------------------------------------------------------------------------------
Comment