Welcome to WebmasterWorld Guest from 54.146.217.179

Forum Moderators: ocean10000

Message Too Old, No Replies

asp.net form mail noob

what code to use?

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

Junior Member

10+ Year Member

joined:July 1, 2004
posts:42
votes: 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)

Full Member

10+ Year Member

joined:Jan 23, 2004
posts:338
votes: 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

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members