homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

asp.net form mail noob
what code to use?

 5:50 am on Mar 28, 2007 (gmt 0)

I'm doing a simple form mail in asp.net - I've figured out how to use the Visual Web Developer 2005 express edition to do the validation, but the form mail part escapes me. There is a tutorial on asp.net (the website) with video and the whole 9 yards BUT it glosses over the part I need, which is the really really basic (to everybody but me) how to set up the sendmail/cdonts/smtp part of the equation. Anybody have some simple code? I've got just 5 boneheaded text fields to email back, but I'm stumped on the basics. Here is my cry for help. HELP!



 5:49 am on Apr 1, 2007 (gmt 0)

I am not sure if understand your question, but if you need the code to create the SMTP object, this works for me:

<script language="vb" runat="server">
sub SendEmail(sender as Object, e as EventArgs)
dim mailclient as new SMTPClient("localhost")
Mailclient.send(Email.text, FROM EMAIL ADDRESS,SUBJECT,Comments.text)
end sub

I believe the code you are looking for is:
dim mailclient as new SMTPClient("localhost")

In the beginning of your ASP.NET file, you need to import the SMTP namespace using the following directive:

<%@ Import Namespace="System.Net.Mail" %>

I hope this helps,

Global Options:
 top home search open messages active posts  

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved