Click here to Skip to main content
12,997,201 members (78,005 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi, I'm used this code to send an Email Via embed images into body, and prevent from 'Display images below'[^] on target Emails
this is my code:
using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Text;
using System.IO;
using System.Web.Services;
using System.Globalization;
using System.Net.Mail;
using System.Net.Mime;
using System.Net;
public partial class SendMail : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
    protected void Send(object sender, EventArgs e)
        string subject = "CNet";
        string body = "";
        string from = "from";
        string password = "pwd";
        string server = "";
        string to = "";
            MailMessage mail = new MailMessage();
            mail.From = new MailAddress(from, subject);
            mail.Subject = "Test with Image";
            string Body = "Welcome to!!<br><BR>Online resource for .net articles.<BR><img alt=\"\" hspace=0 src=\"cid:imageId\" align=baseline border=0 >";
            AlternateView htmlView = AlternateView.CreateAlternateViewFromString(Body, null, "text/html");
            LinkedResource imagelink = new LinkedResource(Server.MapPath(".") + @"\pic.gif", "image/gif");
            imagelink.ContentId = "imageId";
            imagelink.TransferEncoding = System.Net.Mime.TransferEncoding.Base64;
            SmtpClient smtp = new SmtpClient();
            smtp.Port = 25;
            smtp.Host = server;
            smtp.Credentials = new NetworkCredential(from, password);
            //smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
        catch (Exception ex)
Posted 18-Feb-13 18:31pm
Updated 18-Feb-13 18:33pm
ridoy 19-Feb-13 2:49am
So what is the problem?what is your question?
shajarian_lover 19-Feb-13 5:26am
i want to prevent from display this Question on users mail, please check the following link and see the image.

actually, without the user click on the 'Display images below', the images that embed into mail body, can be seen.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170622.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100