Thursday, March 25, 2010

Smtp Mail send

Smtp Mail send



Using This Code Send Smtp Mail as Simple way Where No attachment Write This code In Send mail event Change Smatp Server as your mailserverip instead of "localhost"

Server.ScriptTimeout = 1000;
Response.Flush();

SmtpMail.SmtpServer = "localhost"; 
MailMessage mail = new MailMessage();
mail.To = this.TextBoxTo.Text;
mail.Cc = this.TextBoxCc.Text;
mail.Bcc = this.TextBoxBcc.Text;
mail.From = this.TextBoxFrom.Text;
mail.Subject = this.TextBoxSubject.Text;
mail.Body = this.TextBoxBody.Text;
   
try
{
SmtpMail.Send(mail);
Response.Write(" The Mail has been sent to: 
"); Response.Write("• To: " + mail.To + ""); Response.Write("• Cc: " + mail.Cc + ""); Response.Write("• Bcc: " + mail.Bcc + ""); } catch(System.Exception ex) { Response.Write("An erros has occured: " + ex.Message + "
"); } Response.Flush();

Action Method in Mvc

In this section, you will learn about the action method of controller class. All the public methods of a Controller class are called Act...