473,395 Members | 1,666 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

To send a mail using asp.net(c#)

35
hello,

I want to write the application in which if I click on send button then message sent to particular URL.

could u help me to solve my prob.
Dec 16 '06 #1
2 1436
hello,

I want to write the application in which if I click on send button then message sent to particular URL.

could u help me to solve my prob.
Hi In order to send mail to particular email address
1.please configure SMTP server in your system
2.use namespaces using sytem.web and system.web.mail

U will get all the requiared functions from this two namespaces
Dec 16 '06 #2
hai
i had tested with System.web.mail in VS 2005but i got only error saying obsulete method so i tried with System.net.mail no error but the message is not send

Try with System.Net class
*************************************************
sample code

StringWriter str = new StringWriter();
System.Net.Mail.MailMessage mes = new System.Net.Mail.MailMessage("rchandran.t@gmail.com ", "nglravi@rediffmail.com");
HtmlTextWriter htw = new HtmlTextWriter(str);
htw.RenderBeginTag("html");
htw.RenderBeginTag("title");
htw.Write("Thank u " + TextBox1.Text);
htw.RenderEndTag();
htw.RenderEndTag();
htw.RenderBeginTag("Body");
htw.WriteLine("Thank u for registering with us");
htw.RenderEndTag();


mes.Subject = "Auto reply";
mes.Body = htw.ToString();
try
{
System.Net.Mail.SmtpClient smpt = new System.Net.Mail.SmtpClient("local");
smpt.Send(mes);
}
catch (Exception ee)
{
Response.Write(ee.Message);
}
}
*****************************************

if any error kindly correct
Dec 17 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: John J. Hughes II | last post by:
I have a service that needs to send e-mail alerts. I have been attempting to use the System.Net.Mail function from .NET but this seems to require the IIS be installed and running. Since some of...
2
by: Ryan | last post by:
Hi, I receive an access denied error (see below) when attempting to send an email with BodyFormat=MailFormat.Html from an asp.net page. Exactly the same code works fine in a console...
14
by: supz | last post by:
Hi, I use the standard code given below to send an email from an ASP.NET web form. The code executes fine but no Email is sent. All emails get queued in the Inetpub mail queue. I'm using my...
4
by: =?Utf-8?B?dHBhcmtzNjk=?= | last post by:
I have a web page that at the click of a button must send a bunch (1000+) emails. Each email is sent individually. I have the code working fine, using Mail Message classes and smtp and all that. ...
7
by: Rob Dob | last post by:
The following code is giving me a timeout problem., no matter what I do I can't send a piece of mail using .net2.0 System.Net.Mail.SmtpClient via port 465 and using ssl, if however I try using...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.