Embed Image in EMAIL using .NET 2.0

Introduction

This is my first article.This is simple article which guides you how you can embed images in emails. This can be very useful whenever you want to send enewsletter from your website to Subscriber or marketing of your web site. Main purpose is that you can send nice design HTML page which contains images as it is to your subscriber or any. I had searched on the net when I faced this issue. Iam thankful to manyauthors from where I can make a start to write my first article.

I am also thankful to writer of MIL HTML Parser (http://www.codeproject.com/dotnet/apmilhtml.asp). My intention to write article is that to make the code available for others those who are seeking for such type of code.

This may only work with ASP.NET 2.0 & VB.

Background

Our client needs to send out an email newsletter and wantsed to embed images.

Get into Code

If you want to send HTML document which contains images and wanted to embed images then Select HTML document.

Using MIL HTML Parser, Getting all image node from HTML Document. and assign it to content id.

Now , Using .NET 2.0 feature Adding Resources to Email is AlternateView and LinkedResource which embeds images to mail.

Note:

1. Please specify your SMTP MAIL Server address in web.config and Use it following way :

Dim client As New SmtpClient()

client.Host = ConfigurationManager.AppSettings(”smtpMAIL”)

2. While publishing on Internet ,you have to specify credential following way :

client.Credentials = new System.Net.NetworkCredential(”abc@xyz.com”,”abcxyz”)

Remarks

The image may not be displayed in Outlook Express version 6

Source Code - zip file is attached here with.

Author:

By Samir Shah

Samir Shah is working as a Programmer at Semaphore Infotech Pvt. Ltd, India. He started his IT career in programming on .NET Languages ASP.net, Vb.net and C#.net. Beside technical work, he likes watching movies, making new friends & many many things. You can contact me on my email samirshah@semaphore-software.com.

Share on Facebook

         

View blog reactions
Latest Posts
  • Video and Voice Chat on Gmail
  • Forums and social community for Brand Name Promotion
  • Link trading can be helpful for SERP
  • AT&T launched Video Crawler
  • No importance of back link from .edu and .gov domain
  • Increase Inbound Links - Link Building
  • After a Google Penalty, when sites come in ranking?
  • Google and Yahoo advertisement end
  • Google ranking change – November 2008
  • How can I improve my page rank?
  • Leave a Reply

    You must be logged in to post a comment.



    View My Stats