homepage Welcome to WebmasterWorld Guest from 54.226.191.80
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
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?
bgirl




msg:3295069
 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!

 

brucec




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

Bgirl,
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
</script>

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,
Bruce

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