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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Sending e-mails with unicode encoding

Sending e-mails with unicode encoding

Scheduled Pinned Locked Moved ASP.NET
csharphtmlasp-netwpfsysadmin
1 Posts 1 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.
  • A Offline
    A Offline
    Ahmed Galal
    wrote on last edited by
    #1

    i have no problem in sending the email, but my problem is that theres some unicode characters in the email which is not readable when viewed at the client. however i used UTF-8 encoding like:

    mMessage.SubjectEncoding = System.Text.Encoding.UTF8;
    mMessage.BodyEncoding = System.Text.Encoding.UTF8

    heres what i do from the begining i first open an html file and get its content in a string

    sr = File.OpenText(System.Web.HttpContext.Current.Server.MapPath(@"~\Controls\Mailer\Templates\common.htm"));
    mystring = sr.ReadToEnd();

    then i replace some words in the string with my own, like:

    mystring = mystring.Replace("%name%","unicode word");

    and finally i send this string as html in the email body. only the replaced words is not readable but the other unicode characters that was originally in the htm file is fine ! am using c# asp.net 2.0 i also want to note that everythin was going fine in .net 1.1 , that happened only when i switched to .net 2.0 can u please find any solution ? i will really appreciate any idea thanx in advance. We never stop learning

    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