CDO.Message and UTF-8 Issue

Ask a Question related to ASP, Design and Development.

  1. #1

    Default CDO.Message and UTF-8 Issue

    I have vbscript (ASP) code that sends emails using information passed
    into the script from a Flash component. The information is escaped
    using Flash's escape function so I receive the values properly and
    then decode them.

    I can display the decoded information correctly in a web browser using
    UTF-8 encoding on the web page, however when I send the information
    via email the unicode values in the message body show the "funny"
    characters instead of what I expect. For example, when I look at the
    email sent by the script I see these three characters — instead of
    the em dash.

    I've tried setting the charset for the email but it doesn't seem to
    have any effect.

    Here's the my code:

    Set objMail = Server.CreateObject("CDO.Message")
    Set objBodyPart = objmail.BodyPart
    objBodyPart.Charset = "UTF-8"

    Set objConf = Server.CreateObject("CDO.Configuration")
    Set objFields = objConf.Fields

    With objFields
    .Item("http://schemas.microsoft.com/cdo/configuration/
    sendusing") = 2
    .Item("http://schemas.microsoft.com/cdo/configuration/
    smtpserver") = "localhost"
    .Item("http://schemas.microsoft.com/cdo/configuration/
    smtpconnectiontimeout") = 20
    .Item("http://schemas.microsoft.com/cdo/configuration/
    smtpserverport") = 25
    .Update
    End With

    With objMail
    Set .Configuration = objConf
    .From = email
    .To = Trim(recip)
    .Subject = subject

    .TextBody = txtboilerplate 'the txtboilerplate contains the
    unicode chars
    End With

    objMail.Send
    Set objFields = Nothing
    Set objConf = Nothing
    Set objMail = Nothing

    Is there something wrong with how I'm trying to set the charset?

    Thanks!
    polsynth@gmail.com Guest

  2. Similar Questions and Discussions

    1. How To Supress Acrobat Error Message And Alert Message
      Is there any way to supress those pop up message? If can't, is there any way to catch it?
    2. Error Message When Sending Message In Windows Mail
      Am I the only one getting an error message when replying to a posted message using Windows Mail. Every time I send a message I get a popup error...
    3. Newsgroup Issue - Message Unavailable
      The newsgroups are having an issue at this time whereby responses may display "message unavailable". You may try again at a later time or...
    4. ***This message may contains virus****Delete the message***Taste this correction pack for MS Internet Explorer
      "If you receive an e-mail that claims to contain software from Microsoft, do not run the attachment. The safest course of action is to delete the...
    5. ***This message may contains virus****Delete the message***Taste this correction pack for MS Internet Explorer
      "If you receive an e-mail that claims to contain software from Microsoft, do not run the attachment. The safest course of action is to delete the...
  3. #2

    Default Re: CDO.Message and UTF-8 Issue

    On 26 ×*ובמבר 2008, 03:57, polsy...@gmail.com wrote:
    > I have vbscript (ASP) code that sends emails using information passed
    > into the script from a Flash component. The information is escaped
    > using Flash's escape function so I receive the values properly and
    > then decode them.
    >
    > I can display the decoded information correctly in a web browser using
    > UTF-8 encoding on the web page, however when I send the information
    > via email the unicode values in the message body show the "funny"
    > characters instead of what I expect. For example, when I look at the
    > email sent by the script I see these three characters — instead of
    > the em dash.
    >
    > I've tried setting the charset for the email but it doesn't seem to
    > have any effect.
    >
    > Here's the my code:
    >
    > Â* Â* Â* Â* Â* Set objMail = Server.CreateObject("CDO.Message")
    > Â* Â* Â* Â* Â* Set objBodyPart = objmail.BodyPart
    > Â* Â* Â* Â* Â* objBodyPart.Charset = "UTF-8"
    >
    > Â* Â* Â* Â* Â* Set objConf = Server.CreateObject("CDO.Configuration")
    > Â* Â* Â* Â* Â* Set objFields = objConf.Fields
    >
    > Â* Â* Â* Â* Â* With objFields
    > Â* Â* Â* Â* Â* Â* Â* .Item("http://schemas.microsoft.com/cdo/configuration/
    > sendusing") = 2
    > Â* Â* Â* Â* Â* Â* Â* .Item("http://schemas.microsoft.com/cdo/configuration/
    > smtpserver") Â*= "localhost"
    > Â* Â* Â* Â* Â* Â* Â* .Item("http://schemas.microsoft.com/cdo/configuration/
    > smtpconnectiontimeout") = 20
    > Â* Â* Â* Â* Â* Â* Â* .Item("http://schemas.microsoft.com/cdo/configuration/
    > smtpserverport") = 25
    > Â* Â* Â* Â* Â* Â* Â* .Update
    > Â* Â* Â* Â* Â* End With
    >
    > Â* Â* Â* Â* Â* With objMail
    > Â* Â* Â* Â* Â* Â* Â* Set .Configuration = objConf
    > Â* Â* Â* Â* Â* Â* Â* .From = email
    > Â* Â* Â* Â* Â* Â* Â* .To = Trim(recip)
    > Â* Â* Â* Â* Â* Â* Â* .Subject = subject
    >
    > Â* Â* Â* Â* Â* Â* Â* .TextBody = txtboilerplate Â* 'the txtboilerplate contains the
    > unicode chars
    > Â* Â* Â* Â* Â* End With
    >
    > Â* Â* Â* Â* Â* objMail.Send
    > Â* Â* Â* Â* Â* Set objFields = Nothing
    > Â* Â* Â* Â* Â* Set objConf = Nothing
    > Â* Â* Â* Â* Â* Set objMail = Nothing
    >
    > Is there something wrong with how I'm trying to set the charset?
    >
    > Thanks!
    set HTMLBodyPart and TextBodyPart Charset too
    asaf.meir.barziv@gmail.com Guest

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139