HI, i get the above error, could some help me debug it please, the error i am getting is below
The specified string is not in the form required for an e-mail address.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: The specified string is not in the form required for an e-mail address.
Source Error:
Line 11: Private Sub Sendmail(ByVal from As String, ByVal body As String)
Line 12: Dim mailservername As String = "mail"
Line 13: Dim message As MailMessage = New MailMessage(from, "me@me.co.uk", "feedback", body)
Line 14: Dim mailclient As SmtpClient = New SmtpClient
Line 15:
Source File: C:\Documents and Settings\Danny.DESBOROUGH\
Desktop\ch
arta\Enqui
re.aspx.vb
Line: 13
Stack Trace:
[FormatException: The specified string is not in the form required for an e-mail address.]
System.Net.Mime.MailBnfHel
per.ReadMa
ilAddress(
String data, Int32& offset, String& displayName) +1334
System.Net.Mail.MailAddres
s.ParseVal
ue(String address) +246
System.Net.Mail.MailAddres
s..ctor(St
ring address, String displayName, Encoding displayNameEncoding) +78
System.Net.Mail.Message..c
tor(String
from, String to) +108
System.Net.Mail.MailMessag
e..ctor(St
ring from, String to) +111
System.Net.Mail.MailMessag
e..ctor(St
ring from, String to, String subject, String body) +14
Contact.Sendmail(String from, String body) in C:\Documents and Settings\Danny.DESBOROUGH\
Desktop\ch
arta\Enqui
re.aspx.vb
:13
Contact.Wizard1_FinishButt
onClick(Ob
ject sender, WizardNavigationEventArgs e) in C:\Documents and Settings\Danny.DESBOROUGH\
Desktop\ch
arta\Enqui
re.aspx.vb
:9
System.Web.UI.WebControls.
Wizard.OnF
inishButto
nClick(Wiz
ardNavigat
ionEventAr
gs e) +75
System.Web.UI.WebControls.
Wizard.OnB
ubbleEvent
(Object source, EventArgs e) +621
System.Web.UI.WebControls.
WizardChil
dTable.OnB
ubbleEvent
(Object source, EventArgs args) +17
System.Web.UI.Control.Rais
eBubbleEve
nt(Object source, EventArgs args) +35
System.Web.UI.WebControls.
Button.OnC
ommand(Com
mandEventA
rgs e) +86
System.Web.UI.WebControls.
Button.Rai
sePostBack
Event(Stri
ng eventArgument) +156
System.Web.UI.WebControls.
Button.Sys
tem.Web.UI
.IPostBack
EventHandl
er.RaisePo
stBackEven
t(String eventArgument) +7
System.Web.UI.Page.RaisePo
stBackEven
t(IPostBac
kEventHand
ler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePo
stBackEven
t(NameValu
eCollectio
n postData) +33
System.Web.UI.Page.Process
RequestMai
n(Boolean includeStagesBeforeAsyncPo
int, Boolean includeStagesAfterAsyncPoi
nt) +4921
The code behind is as follows
Private Sub Sendmail(ByVal from As String, ByVal body As String)
Dim mailservername As String = "mail"
Dim message As MailMessage = New MailMessage(from, "me@somwhere.co.uk", "feedback", body)
Dim mailclient As SmtpClient = New SmtpClient
mailclient.Host = mailservername
mailclient.Send(message)
message.Dispose()
End Sub
Start Free Trial