google analytics

Saturday, July 12, 2008

Simple Mail send Through .NET

Hello all ,
Today i will describe how to send mail through .NET
First we have to configure the SMTP mail server . In this context i have assumed you mail server has been configured (including web.config ).
Now we have to import

using System.Net;
using System.Net.Mail;
And through the following code we will able to send mail with attachment.
MailMessage msg = new MailMessage();
msg.From = new MailAddress("mail@test.com");
msg.To.Add(new MailAddress("mail_1@test.com"));
msg.To.Add(new MailAddress("mail_2@test.com"));
msg.CC.Add(new MailAddress("mail_3@test.com"));
msg.Bcc.Add(new MailAddress("mail_4@test.com"));
msg.Attachments.Add(new Attachment(@"c:\file.txt"));
msg.Subject = "This is a test mail";
msg.Body = "This is the body of the mail";
SmtpClient client = new SmtpClient();
client.Send(msg);

Saturday, July 5, 2008

Event fire at certain time.

(This article is taken from one of my other blog.) from few days one thing is clicking in my head very simple but not initiated before.so i have posted the problem in phpfreaks forum and got some useful solutions : #1 : hi i want to know how to run continuous service which is written in php? for example : i want to inform through email to my clients in a particular time automatically , how to do it ? Thanking you Tanvir.
=> Cron job.
# 2 : but there is one question more, if i use corn job then i must have access to modify the etc/corntab in any linux server, generally when we hosting a site then we dont have the permission to modify any server scripts like corntab unless its a dedicated server. is there any other solution to do the job avoiding this problem? =>If you don't have access to the crontab, then you most certainly won't have access to the init scripts required to run a service. => ot entirely true. On many 'shared' hosting plans that use stuff like cpanel, they will allow you to set up your own cron jobs. Fairly easily too. =>if not many people provide external crontab access so that you can have a psedo cron tab by having another server ping your cron job page. they might cost you a monthly fee, but it be better than switching hosting companies

Easy Northwind Database installation.

Its pretty much needed to work with a existing relational database to test any new features of a language,but its really tough to get it at the right moment. We can easily get one from Microsoft's Northwind database.First we have to install SQL Server Management Studio and then download the sample database form here . After installing the SampleDB, it will create a directory named "C:\SQL Server 2000 Sample Databases" . In this Database we will get some files including NORTHWND.MDF.To use it, first we have some inital tasks to do ... 1. In the first step we have to double click on "instnwnd.sql" which is in the "C:\SQL Server 2000 Sample Databases" folder , after click SQL Server Management Studio will automaticly open then we have to press the "Execute" button. 2. In the similar way we also wave to double click on "instpubs.sql" and do the same thing. after that when we connect our SQL server we foud our desired NORTHWIND database . in the above topic i have escaped many vital technical issues just to make the article simple any easy to read as well as easy to impliment. hope it will work. have a nice day.