C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

How to Send Email through SMTP ASP.NET 2.0


Posted Date: 29 Nov 2008      Posted By: suman space      Member Level: Bronze     Points: 1   Responses: 8



i wish to send emailform a Webpage ASP.NEt 2.0 .

i dont have own domain.
...

give Detailed idea...





Responses

Author: Arun Jacob    29 Nov 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 4

You can send mail using System.Web.Mail Namespace.


MailMessage message= new MailMessage();
message.From = "fromemailid;
message.To = "toemailid";
message.Subject = "Subject of the Mail";
message.Body = "Body Of the Mail";
SmtpMail.SmtpServer = "yourservername";
SmtpMail.Send(message);


:-)

Arun Jacob
http://codepronet.blogspot.com/



Author: ChandraShekar Thota    29 Nov 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 1

Hi

You can use gmail smtp for testing.
It is smtp.googlemail.com

Cheers
Chandu

chandrashekarthota@gmail.com /92 93 95 95 39
FREE SESSIONS ON .NET AND VISUALSTUDIO



Author: srujana    30 Nov 2008Member Level: BronzeRating: 2 out of 52 out of 5     Points: 6

MailAddress ad = new MailAddress(TextBox1.Text, "srujana");
mail.From = ad;
MailAddress ad1 = new MailAddress(TextBox2.Text);
MailAddressCollection adc = new MailAddressCollection();
adc.Add(ad1);
mail.To.Add(ad1);
mail.Subject = TextBox3.Text;
mail.Body = TextBox4.Text;

mail.Priority = MailPriority.Normal;
//for gmail
SmtpClient objMail = new SmtpClient("smtp.gmail.com", 587);
//for hotmail
//SmtpClient hotmail = new SmtpClient("smtp.live.com", 24);
NetworkCredential info = new NetworkCredential("abc@gmail.com", "xyz");
objMail.DeliveryMethod = SmtpDeliveryMethod.Network;
objMail.Credentials = info;
objMail.EnableSsl = true;
try
{
objMail.Send(mail);
} }
catch (Exception ex)
{
Response.Write(ex.Message);
}



Author: Deepika Haridas    30 Nov 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 6

MailAddress ad = new MailAddress(txtadd.Text, "abc");
mail.From = ad;
MailAddress ad1 = new MailAddress(txtadd1.Text);
MailAddressCollection adc = new MailAddressCollection();
adc.Add(ad1);
mail.To.Add(ad1);
mail.Subject = txtsub.Text;
mail.Body = txtbody.Text;

mail.Priority = MailPriority.Normal;
SmtpClient objMail = new SmtpClient("smtp.gmail.com", 587);
NetworkCredential info = new NetworkCredential("xxx@gmail.com", "xyz");
objMail.DeliveryMethod = SmtpDeliveryMethod.Network;
objMail.EnableSsl = true;
try
{
objMail.Send(mail);
} }
catch (Exception ex)
{
Response.Write(ex.Message);
}

Regards,
Deepika



Thanks & Regards,
Deepika
Editor

If U want to shine like a SUN..First U have to burn like the SUN!!
Need a Guide? Join my mentor program..



Author: puneet malviya    30 Nov 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 6

Hi ..

<% @Page Language="C#" %>
<% @Import Namespace="System.Web.Mail" %>
<%
MailMessage msgMail = new MailMessage();

msgMail.To = "christophw@sleeper.Dev.AlfaSierraPapa.Com";
msgMail.Cc = "webmaster@sleeper.Dev.AlfaSierraPapa.Com";
msgMail.From = "webmaster@aspheute.com";
msgMail.Subject = "Hi Chris, another mail";

msgMail.BodyFormat = MailFormat.Html;
string strBody = "<html><body><b>Hello World</b>" +
" <font color=\"red\">ASP.NET</font></body></html>";
msgMail.Body = strBody;

SmtpMail.Send(msgMail);

Response.Write("Email was queued to disk");
%>

And check this link this link is helpful for u


http://www.aspheute.com/english/20000918.asp

check it



Author: puneet malviya    30 Nov 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 6

Hi ..

<% @Page Language="C#" %>
<% @Import Namespace="System.Web.Mail" %>
<%
MailMessage msgMail = new MailMessage();

msgMail.To = "christophw@sleeper.Dev.AlfaSierraPapa.Com";
msgMail.Cc = "webmaster@sleeper.Dev.AlfaSierraPapa.Com";
msgMail.From = "webmaster@aspheute.com";
msgMail.Subject = "Hi Chris, another mail";

msgMail.BodyFormat = MailFormat.Html;
string strBody = "<html><body><b>Hello World</b>" +
" <font color=\"red\">ASP.NET</font></body></html>";
msgMail.Body = strBody;

SmtpMail.Send(msgMail);

Response.Write("Email was queued to disk");
%>

And check this link this link is helpful for u


http://www.aspheute.com/english/20000918.asp

check it



Author: Asal-2009    30 Nov 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 6

hi,
u first import the namespace for mail

Imports System.Web.Mail

then put the below code and call it whereever ur want.

Sub sendmail(ByVal password)

Dim objEmail As New MailMessage
objEmail.To = txtEmail.Text
objEmail.From = "nathan.rengan@gmail.com"
objEmail.Subject = "Regarding Password"
objEmail.Body = "this is your new password " + password
Try
SmtpMail.Send(objEmail)
txtUserName.Text = ""
txtEmail.Text = ""
Response.Write("Your E-mail has been sent sucessfully")

Catch exc As Exception
Response.Write("Send failure: " + exc.ToString())
End Try
End Sub

i hope this may help u

G.Rajan
Happy New Year



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : mobile prob..
Previous : how to working in return url concept in asp.net
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use