Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Asp.net 2.0 Mail

Asp.net 2.0 Mail

Scheduled Pinned Locked Moved ASP.NET
csharpasp-net
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Satish_S
    wrote on last edited by
    #1

    i Have given image tag inside td in Body but not displaying message. but if i tried for inline attachment with System.Net.Mail.LinkedResource then getting as image embed but while embeding like this mails are getting late to send follow is the code part i am using

    Body = "

    Body += "";
    Body += "";
    Body += "";
    Body += "";
    Body += "

    ";
    Body += "";
    Body += "";
    Body += "

    ";

    G K 2 Replies Last reply
    0
    • S Satish_S

      i Have given image tag inside td in Body but not displaying message. but if i tried for inline attachment with System.Net.Mail.LinkedResource then getting as image embed but while embeding like this mails are getting late to send follow is the code part i am using

      Body = "

      Body += "";
      Body += "";
      Body += "";
      Body += "";
      Body += "

      ";
      Body += "";
      Body += "";
      Body += "

      ";

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      I can only see fractions of your code. Use the "Ignore HTML" option when you are posting markup code.

      sathimailin1 wrote:

      i Have given image tag inside td in Body but not displaying message.

      Is it the mail message that is not displayed, or the contents of the message that is not displayed? Where is it not displayed?

      sathimailin1 wrote:

      while embeding like this mails are getting late to send

      How are you embedding the image? What do you mean by "late to send"?

      Despite everything, the person most likely to be fooling you next is yourself.

      S 1 Reply Last reply
      0
      • G Guffa

        I can only see fractions of your code. Use the "Ignore HTML" option when you are posting markup code.

        sathimailin1 wrote:

        i Have given image tag inside td in Body but not displaying message.

        Is it the mail message that is not displayed, or the contents of the message that is not displayed? Where is it not displayed?

        sathimailin1 wrote:

        while embeding like this mails are getting late to send

        How are you embedding the image? What do you mean by "late to send"?

        Despite everything, the person most likely to be fooling you next is yourself.

        S Offline
        S Offline
        Satish_S
        wrote on last edited by
        #3
        string Body;
        AlternateView htmlIV;
        

        SqlConnection _oSqlconn;
        SqlCommand _oSqlCmd;
        SqlDataAdapter _oAdapt = new SqlDataAdapter();
        DataTable DT;
        DT = new DataTable();
        string Sqlstr;

                \_oSqlconn = new SqlConnection(ConfigurationManager.AppSettings\["Test"\]);
                \_oSqlconn.Open();
                 Sqlstr = "select cEmail\_id1 from Master\_Contacts";
                \_oSqlCmd = new SqlCommand(Sqlstr, \_oSqlconn);
                \_oSqlCmd.CommandType = CommandType.Text;
                \_oAdapt.SelectCommand = \_oSqlCmd;
                \_oAdapt.Fill(DT);  
                \_oSqlconn.Close();
        
        
        
        Body = "";
        Body += "";
        Body += "";
        Body += "
        

        ";
        Body += "";
        Body += "";
        Body += "";
        Body += "";
        Body += "

        ";
        Body += "

        ";

        htmlIV = System.Net.Mail.AlternateView.CreateAlternateViewFromString(Body, null, "text/html");
        
        
        System.Net.Mail.LinkedResource imagelink = new System.Net.Mail.LinkedResource(Server.MapPath(".") + "\\\\images\\\\S.jpg", "image/jpeg");
        
        
        imagelink.ContentId = "imageId";
        
        imagelink.TransferEncoding = System.Net.Mime.TransferEncoding.Base64;
        
        htmlIV.LinkedResources.Add(imagelink);
        
        
        System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage("xyc2@yahoo.com", Convert.ToString(DT.Rows\[i\]\["cEmail\_id1"\]), ConfigurationManager.AppSettings\["Subj"\], Body);
        mail.AlternateViews.Add(htmlIV);
        System.Net.NetworkCredential mailAuthentication = new System.Net.NetworkCredential(ConfigurationManager.AppSettings\["MailID"\], ConfigurationManager.AppSettings\["Pass"\]);
        System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient("smtp.gmail.com", 25);
        mailClient.EnableSsl = true;
        mailClient.UseDefaultCredentials = false;
        mailClient.Credentials = mailAuthentication;
        mailClient.Send(mail);
        

        Above is the way i used to send a mail with embed image and this becomes slow to send mail i.e to send 5 mails for example it takes 3 minutes. II i tried to write an image inside td of Body message src=mypath instead of src='cid:imageId' but result is i am getting

        1 Reply Last reply
        0
        • S Satish_S

          i Have given image tag inside td in Body but not displaying message. but if i tried for inline attachment with System.Net.Mail.LinkedResource then getting as image embed but while embeding like this mails are getting late to send follow is the code part i am using

          Body = "

          Body += "";
          Body += "";
          Body += "";
          Body += "";
          Body += "

          ";
          Body += "";
          Body += "";
          Body += "

          ";

          K Offline
          K Offline
          knbinoj58
          wrote on last edited by
          #4

          specify full path of your image like http://yoursite.com/images/S.JPG....

          S 1 Reply Last reply
          0
          • K knbinoj58

            specify full path of your image like http://yoursite.com/images/S.JPG....

            S Offline
            S Offline
            Satish_S
            wrote on last edited by
            #5

            Hi Thanks image got displayed when i give path as you mentioned but in gmail when opening mail gmail is showing diplay images below i dont want to get message rather it should display image when user open a mail, can u tell me why i am getting error

            K 1 Reply Last reply
            0
            • S Satish_S

              Hi Thanks image got displayed when i give path as you mentioned but in gmail when opening mail gmail is showing diplay images below i dont want to get message rather it should display image when user open a mail, can u tell me why i am getting error

              K Offline
              K Offline
              knbinoj58
              wrote on last edited by
              #6

              No chance at all!!!. It's gmail's property. we can't change it...

              S 1 Reply Last reply
              0
              • K knbinoj58

                No chance at all!!!. It's gmail's property. we can't change it...

                S Offline
                S Offline
                Satish_S
                wrote on last edited by
                #7

                hi ok i agree with you and thanks a lot for your suggestion

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups