Send Email Using .Net

use the following code the generate an email by using .net 


MailMessage message = new MailMessage();
SmtpClient client = new SmtpClient();
message.To.Add(new MailAddress("to@yahoo.com"));
message.Subject = "New email subject";
message.IsBodyHtml = true;
message.Body = "your email text of email will come here";
string hostname = "mail.hostname.com";
client.Host = hostname;
string username = "info@yourdomainname.com";
string password = "yourpasswordhere";
message.From = new MailAddress("from@domainname.com");
System.Net.NetworkCredential basicCredentials = new System.Net.NetworkCredential(username, password);
client.Credentials = basicCredentials;
client.Send(message);

message.body = “your actual email text”

following name space will be used for it.

using System.Net.Mail;

 

 


Be the first to comment - What do you think?  Posted by admin - February 15, 2012 at 3:09 am

Categories: ASP.Net, C#   Tags:

add a constraint to a database column to restrict entry of scripts

alter table tblCustomers
add constraint CK_tblCustomers_currency_name
check ((charindex(‘<‘,[currency_name],(0))=(0)));

Be the first to comment - What do you think?  Posted by admin - December 12, 2011 at 9:01 am

Categories: SQL Server   Tags:

How to Change schema information in database

Execute the following command in sql server query

SELECT 'ALTER SCHEMA dbo TRANSFER ' + s.Name + '.' + o.Name
FROM sys.Objects o
INNER JOIN sys.Schemas s on o.schema_id = s.schema_id
WHERE s.Name = 'webente_ilmkidunya'
And (o.Type = 'U' Or o.Type = 'P' Or o.Type = 'V')

it will return a set of queries that will be used to alter the schema of the objects

Be the first to comment - What do you think?  Posted by admin - October 28, 2011 at 2:45 am

Categories: SQL Server   Tags:

Next Page »