Hi All!
I would greatly appreciate your help on this:
I am creating a Windows Forms Application using Visual Studio Express Edition 2008 (C#). It's just a basic text editor with uber cool features. But what I'm having trouble with is this:
I have a textbox control on the form, and I need the user to be able to enter text into the control and when they click the 'send' or 'submit' button which is placed directly below the textbox control the application then sends the value of TextBox to my email address.
Like I said your help/suggestions would be GREATLY appreciated, I'm really stuck on this one.
Thanks in advance :-)
Jason.
Loading
Ryan AlfordPosted Aug 11, 2008, 10:01 AM
Muhammad gave you generic information to show you how it should be formatted. That information was never intended to work "as-is".
jason pezzimentiPosted Aug 11, 2008, 12:19 AM
Hi there, thank yo so much for that code :-D. I do have a couple of questions, for the IP address: "000.00.0.00" do I leave that 'as-is' or do i need to put some other IP address in there? And the [email protected] email address, can I leave that blank or does that need editing, the reason I am asking is because I followed your super-easy instructions :) and it gave me an error mesage:
Failed sending message: SmtpException Was Unhandled. ... Is this something that I am doing wrong here? I'd really appreciate your help again, so sorry.
Regards,
Jason. :-)
Muhammad Shahid FarooqPosted Aug 10, 2008, 8:41 PM
using
System.Net.Mail;write the following code in the click event of send button
MailMessage
objMailMessage = new MailMessage("[email protected]", "[email protected]", "subject", textbox.Text); SmtpClient objSmtpClient = new SmtpClient();objSmtpClient.UseDefaultCredentials =
true;objSmtpClient.Host =
"000.00.0.00";objSmtpClient.Port = 25;
objSmtpClient.Send(objMailMessage);
Ryan AlfordPosted Aug 10, 2008, 2:24 PM