Friday, July 27, 2007

Insert image in Html mail using .Net

I guess, we all are habituated with E-Mails. Sometimes we need to transfer more information in E-Mails so we attach files, presentations, images etc. and when we need it to be more attractive and colorful then we try our hand with Html for making more colorful and attractive and insert images as necessary to make it more meaningful.

When we need to build this type of actions in our application, then we search for related Components and Libraries to get support from. So let's discuss about .Net supported libraries to achieve this type of action in our application. In this article we will cover the System.Net.Mail Namespace of System.dll in .Net Framework 2.0 to build a mailing application.


Now we are going to build a Service or Application that will Send Mail with some interesting features like; body content in html format, send to multiple recipients, send mail with attachment(s), to make it more meaningful send Html mail with Images Embedded in it, send html mail with embedded images and attachments, mail with multipart bodies etc..

A simple Html mail:

Let's check a mail message created by System.Net.Mail.MailMessage to send a mail...

The codes are:

Sample for Html mail:


Public Sub SendHtmlMail()

'create the mail message

Dim mail As New MailMessage("from@fromdomain.com", "to@todomain.com")

'set the message content

mail.Subject = "This mail has Html Body.."

mail.Body = "This is a sample body with html in it. This is bold This is blue"

mail.IsBodyHtml = True

'send mail

SendMail(mail)

End Sub ' End SendHtmlMail


Private Sub SendMail(ByVal mail As Mail.MailMessage)

'send the message using SMTP client

Dim smtp As New SmtpClient(_mailServer) 'mail Server IP or NAME

smtp.Credentials = CredentialCache.DefaultNetworkCredentials

smtp.Send(Mail)

End Sub ' End SendMail


Here "mail" is the instance of MailMessage Class. There are four overloaded constructors available initializing different properties of MailMessage Class during making instance.........



For more details please visit : http://aspalliance.com/1354_Sending_HTML_Mail_with_Embedded_Image_in_NET



Thanks,

Soyuj Kumar...Coffee Drinker

Tuesday, July 24, 2007

A Theory of Everything?

The String theory... :
.
.
Some physicists believe string theory may unify the forces of nature
.
.
The fundamental particles of the universe that physicists have identified—electrons, neutrinos, quarks, and so on—are the "letters" of all matter. Just like their linguistic counterparts, they appear to have no further internal substructure. String theory proclaims otherwise. According to string theory, if we could examine these particles with even greater precision—a precision many orders of magnitude beyond our present technological capacity—we would find that each is not pointlike but instead consists of a tiny, one-dimensional loop. Like an infinitely thin rubber band, each particle contains a vibrating, oscillating, dancing filament that physicists have named a string.
:
.
Field of dreams :
.

In Einstein's day, the strong and weak forces had not yet been discovered, but he found the existence of even two distinct forces—gravity and electromagnetism—deeply troubling. Einstein did not accept that nature is founded on such an extravagant design. This launched his 30-year voyage in search of the so-called unified field theory that he hoped would show that these two forces are really manifestations of one grand underlying principle. This quixotic quest isolated Einstein from the mainstream of physics, which, understandably, was far more excited about delving into the newly emerging framework of quantum mechanics. He wrote to a friend in the early 1940s, "I have become a lonely old chap who is mainly known because he doesn't wear socks and who is exhibited as a curiosity on special occasions."
.
Get the experience of String theory : http://www.pbs.org/wgbh/nova/elegant/scale.html
:
.
Thanks,
Soyuj Kumar...Reading

Friday, June 8, 2007

CLR Triggers for SQL Server 2005:

As I discussed in my previous articles, now Microsoft SQL Server 2005 is integrated with Microsoft .Net Framework common language runtime (CLR), so we can use any .Net Framework language to create database objects. The CLR provides the execution environment for all the server side objects that are created using a .NET language. This means the database developers can now perform tasks that were impossible or difficult to achieve with T-SQL alone. Especially when working with large amounts of server code, developers can easily organize and maintain their code investments.
:
This article covers different types of triggers supported by Microsoft SQL Server 2005 with basic ideas about them with an example. At last describes the step-by-step approach to create a CLR trigger (a DML type).
:
.
What is Trigger?
:
A trigger is a Database object just like a stored procedure, or we can say it is a special kind of Stored procedure which fires after (/before) a specified language event executes. More specifically the object which is attached to a Table or View or Database schemas for tracking the operations on them. The main difference between a trigger and a stored procedure is that the former is attached to a table or view and is fired only when an INSERT, UPDATE, and/or DELETE occurs, while a stored procedure executes at any time when it is called.
:
.
For more details please visit : http://aspalliance.com/1273
.
.
Thanks,
Soyuj Kumar.. Operator

Thursday, March 22, 2007

Creating SQL functions in VB.Net

This article is related to my previous article CLR integration in SQL Server 2005. This contains a step-by-step method of using Visual Studio for creating CLR based database objects. This also explains the method for debugging the managed code for CLR integrated objects and explains the CLR integrated functions.
:
In this article I am going to discuss how to use Visual Studio 2005 for creating CLR integrated functions. In Visual Studio 2005 there is an option for creating database projects, which is very helpful in this objective.......
.
.
.
Please visit for details : http://aspalliance.com/1157
.
:
.
Regards,
Soyuj Kuamr... Techy

Thursday, February 15, 2007

CLR intergation in SQL Server 2005

We all know how great T-SQL is for database code, but writing procedural code in T-SQL has always been difficult. It seems impossible when we need a stored procedure or two, requiring some array-operations, text-parsing or complex math operations. However, it is quite easy if our Server allows us to deploy C# or VB.NET code that is used within the Server process. In other words, if we need complex procedural code, we can write it as managed code.

:

With the Common Language Runtime (CLR) hosted in Microsoft SQL Server 2005(called CLR integration), we can write stored procedures, triggers, user- defined functions, user-defined types, and user-defined aggregates in managed code. Because managed code compiles to native code prior to execution, we can achieve significant performance increases in some scenarios. Thus SQL Server essentially acts as the operating system for the CLR when it is hosted inside SQL Server....

.

Please visit for more details : http://aspalliance.com/1081

:

.

Thanks,
Soyuj Kuamr... Reading