Advertise with us
Control Panel
Forum
Hosting Help
ASP.NET 4.5 & SQL 2012 Hosting
Resources
Notice
Login
Members
Shared Hosting
|
Upgrade
|
Advertise
|
Tutorials
|
Home
»
Resources
»
how to send a email by asp.net
ASP.NET
ADO.NET
Web Services
Remoting
Visual Studio 2005
Error Bank
Interview Questions
Tips & Tricks
XML
HTML
Jscript/Javascript
IIS
Windows
General
Submit Resource or code snippet
... and get
surprise gifts
Win Digital camera, ASP.NET Books, Free softwares!!
how to send a email by asp.net
09 Jun, 2010
Author:
lingfeng
Summary
how to send a email by asp.net
.NET Classes used :
.Net 2.0
string EmailContent = Request.Form[content].ToString();
MailAddress message = new MailAddress(emailaddress, title);
MailMessage mymail = new MailMessage();
mymail.From = message;
string messageto = toaddr.Text;
mymail.To.Add(messageto);
Attachment MsgAttach = new Attachment(this.FileUpload1.PostedFile.FileName mymail.Attachments.Add(MsgAttach);
mymail.Subject = mailtitle.Text;
mymail.Body = EmailContent;
mymail.IsBodyHtml = true;
mymail.BodyEncoding = System.Text.Encoding.GetEncoding(GB2312);
mymail.Priority = MailPriority.High;
SmtpClient client = new SmtpClient();
client.Host = smtp.gmail.com;
client.Credentials = new NetworkCredential(emialaddess, pwd);
try
{
client.Send(mymail);
Label1.Text = success;
}
catch
{
Label1.Text = Error;
}
}
Feedbacks about this page from members:
Sending Mail
-
Piyush
YOu can send your mail using SMTP Class.
However, if you are under some kind of proxies then you have to come up with the solution so that you can make the ssh tunnel connection.
(29 Jun 2010)
this is .cs page containt ho to send email
-
mohamed hamdy
this is .cs page containt ho to send email via your site
{
MailMessage Msg = new MailMessage();
// Sender e-mail address.
Msg.From = new MailAddress(mail@name.com);
// Recipient e-mail address.
Msg.To.Add(NewUserEmail);
// Subject
Msg.Subject = message;
// Body
Msg.Body = Thanks for registering our website.
Your Activation Key is : + key.ToString() +
;
Msg.IsBodyHtml = true;
// your remote SMTP server IP.
SmtpClient smtp = new SmtpClient();
smtp.Host = smtp.gmail.com;
smtp.Port = 587;
smtp.Credentials = new System.Net.NetworkCredential(yourmail@domin.com, email password);
smtp.EnableSsl = true;
smtp.Send(Msg);
Msg = null;
Page.RegisterStartupScript(UserMsg, );
}
(12 Nov 2011)
answer
-
sameh behairy
public void sendmail_escalation(String ID, string From_Mail, string To_Email, string subject, string body)
{
SmtpClient smtpClient = new SmtpClient();
smtpClient.Host = ID; //Life
System.Net.Mail.MailMessage objMail = new System.Net.Mail.MailMessage();
MailAddress objMail_fromaddress = new MailAddress(From_Mail);
objMail.From = objMail_fromaddress;
//MailAddress objMail_toaddress = new MailAddress(To_Email);
objMail.To.Add(To_Email);
objMail.Subject = subject;
objMail.Body = body.ToString();
objMail.Body = body;
objMail.IsBodyHtml = true;
objMail.Priority = MailPriority.High;
try
{
smtpClient.Send(objMail);
}
catch (Exception exc)
{
Response.Write(Send failure: + exc.ToString());
}
}
(24 Mar 2013)
Submit Feedback
View All Feedbacks
Total
members
:
252410
Average new registrations per day (in last 7 days):
8
New Registration:
Open
Register Now
Talk to Webmaster
Tony John
Facebook
Google+
Twitter
Advertise
Privacy Policy
Terms of use
Contact Us
SpiderWorks Technologies Pvt Ltd.
All Rights Reserved.