Send Email using Vb.NET

Posted by Venkat | Labels: , ,

Now we have to discuss how to send email using GMAIL server.

Normally we can use , Gmail, Yahoo , etc.. some company having own mailserver so you have to contact your Admin to know your mailserver , id , pwd etc..

This is code to send email using Vb.Net

Imports System.Net.Mail

Protected  Sub Button1_Click
(ByVal sender As Object, ByVal e As EventArgs)
Dim mail As MailMessage =  New MailMessage()
mail.To.Add("admin@gmail.com")
mail.From = New MailAddress("admin@gmail.com")
mail.Subject = "Email using Gmail server "

dim Body as String = "Hi, this mail is to test sending mail"+
             "using Gmail in ASP.NET using vb.Net"
mail.Body = Body

mail.IsBodyHtml = True
Dim smtp As SmtpClient =  New SmtpClient()
smtp.Host = "smtp.gmail.com" 
smtp.EnableSsl = True 
smtp.Credentials = New System.Net.NetworkCredential
    ("YourUserName@gmail.com","YourGmailPassword")
smtp.Send(mail)
End Sub

Send Email using CSharp.Net

Posted by Venkat | Labels: ,

Now we have to discuss how to send email using GMAIL server.

Normally we can use , Gmail, Yahoo , etc.. some company having own mailserver so you have to contact your Admin to know your mailserver , id , pwd etc..

This is code to send email using Asp.net user port no is 587 or 465 it depends upon system

declare the port below the smtp server name

smtp.port=587

using System.Net.Mail;


//Now write this code in click event of button

//C# code

protected void Button1_Click(object sender, EventArgs e)
{
  MailMessage mail = new MailMessage();
  mail.To.Add("admin@gmail.com");
  mail.From = new MailAddress("admin@gmail.com");
  mail.Subject = "Email using Gmail";

  string Body = "Hi, this mail is to test sending mail"+
                "using Gmail in ASP.NET using C#";
  mail.Body = Body;

  mail.IsBodyHtml = true;
  SmtpClient smtp = new SmtpClient();
  smtp.Host = "smtp.gmail.com"; 
  smtp.EnableSsl = true; 
  smtp.Credentials = new System.Net.NetworkCredential
       ("YourUserName@gmail.com","YourGmailPassword");
    smtp.Send(mail);
}

//you have to give your Gmail Username and password ..

Validate UniqueIdentifier

Posted by Venkat | Labels: ,

Here we have to discuss about how to validation UniqueIdentifiere using REGEX


Here is the Expression


^\w{7}-\w{4}-\w{4}-\w{4}-\w{12}

How to place favicon in the address bar

Posted by Venkat | Labels:

Here we have to discuss about how to place the favicon on the address bar or ASP.NET Websites

You have to put this code on your head Section of your Html page..

<link rel="shortcut icon" type="image/ico" href="~/favicon.ico">


and here is web site that will convert any pic to icon

http://www.html-kit.com/favicon/



PayOffers.in