How to Send Images in Email using Asp.Net (C#)

While sending the images in emails through .net code, we may require to send them as an attachment or they must be embeded there in the body of the email itself.

Below if the code which describes both the ways of sending the images…

a. Embeded b. As attachment.

Namespaces to be included: 

using System.Net;

using System.Net.Mail;

Code:

SendEmail

 

We can make all these settings like ‘ToAddress’, ‘FromAddress’ , SMTP host server name using the web.config configurations.

Note:  If we need to send the email using our personal domains like gmail, yahoo etc then we need to use password along with the username as shown below:

OtherSMTP

Advertisements
This entry was posted in .Net 2.0. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s