I am trying to learn ASP
I have been using the Visual Web Developer 2005
I have the following line that I can not work out how to convert.
<%
Dim FromForm As String = "Mail@Myname.co.uk"
Dim ToMe As String = "Me@myname.co.uk"
Dim FormSubject As String = "Contact Infomation"
Dim EmailText As String = "Blar Blar Blar"
System.Web.Mail.SmtpMail.Send(FromForm,ToMe,FormSubject,EmailText)
%>
It tells me that I cannot use System.Web.Mail any more and should use System.Net.Mail.
I have been unable to work out what the new code should be to get it to work.
The Language is VB
Can anyone tell me how to change the code to work Please?
I have search every Web Site I could find but they all seem to refer to System.Web.Mail or have pages of code which I am not able to work out which part I need.
Ever hopeful
Steve D Blake
![]() |
0 |
![]() |
See a short introduction to System.Net.Mail in this ASPAlliance article by Brad Kingsley: Sending Email from ASP.NET 2.0.
Terri Morton
Engagement Manager, Neudesic
How to ask a question
![]() |
0 |
![]() |
Thanks that helped.
Got to try it out on the web site now.
![]() |
0 |
![]() |
As you can set the host, port, and all other kinds of stuff right in Web.Config
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network defaultCredentials="false" host="mail.mydomain.com" userName="me@mydomain.com" password="pa$$word" port="25" from="me@mydomain.com"/>
</smtp>
</mailSettings>
</system.net>
And now it truly would be "one line of code to send an email"
"If you make it idiot proof, they'll build a better idiot"
![]() |
0 |
![]() |