Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

.NET Forum


You are currently viewing our .NET Forum as a guest. Please register to participate.
Login



Reply
What's best for email?
Old 10-16-2006, 03:59 PM What's best for email?
Experienced Talker

Posts: 39
Trades: 0
Ive started to dabble with .Net and C# just a little and Im trying to learn more.

Im making a page on my website and want to allow someone to send me an email through a form. I thought this would be a good project to tackle with asp.Net so I could learn something. So I have IIS running now and installed the framework goodies from the Microsoft website. Here is the C# code I have so far and I cant get it to execute, it always fires the catch statement:

<%@ Page Language="C#" %>
<%@ import Namespace="System.Web.Mail" %>
<script runat="server">

void SubmitButton_Click(object sender, EventArgs e) {
MessageLabel.Text = "";
try{
MailMessage FeedbackEmail = new MailMessage();
FeedbackEmail.To = "myemail@email.com";
FeedbackEmail.From = EmailFrom.Text;
FeedbackEmail.Subject = EmailSubject.Text;
FeedbackEmail.Body = EmailMessage.Text;
FeedbackEmail.BodyFormat = MailFormat.Text;
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(FeedbackEmail);
MessageLabel.Text = "Your message has been sent.";
}
catch{
MessageLabel.Text = "Your message could not be sent. Please make sure that the ";
MessageLabel.Text = MessageLabel.Text + "From, Subject, and Message fields are filled in.";
}



So thats all the further Ive gotten. Im sure the reason this doesnt submit is related to syntax but Im new so if this is something stupid please point out my newbieness. Any comments would be appreciated. Thanks!
Turbo6PGT is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-20-2006, 05:36 AM Re: What's best for email?
boomers's Avatar
Extreme Talker

Posts: 229
Trades: 1
Ive done this in VB if you need it still then post here... you can convert it yourself
boomers is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to What's best for email?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09364 seconds with 12 queries