CDO mail formatting issue

Ask a Question related to ASP Components, Design and Development.

  1. #1

    Default CDO mail formatting issue

    Hi, When I set the following for my CDO email, the mail is receievd with the
    html portion does not appear formatted but just as it is seen below. I
    seperated the problem area below with a dashed line to make it easier to
    find in this post.

    Any suggestions would be appreciated.

    Thanks
    David





    <!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
    NAME="CDO for Windows Library" -->

    <!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4"
    NAME="ADODB Type Library" -->
    <%
    SUB sendmail( fromWho, toWho, Subject, Body )

    Dim objCDO
    Dim iConf
    Dim Flds
    Dim msg
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    msg="<html><head><title>E-Mail Link</title><meta http-equiv=""Content-Type""
    content=""text/html; charset=iso-8859-1""></head><body
    bgcolor=""#33FF33""><table width=""400"" height=""300"" border=""1""
    bordercolor=""#000000"" bgcolor=""#33FF33""> <tr><td><table width=""100%""
    border=""0""><tr><td><div align=""center""><a
    href=""http://site.com/friend.htm""><img
    src=""http://site.com/images/e_header.gif"" width=""397""
    height=""101""></a></div></td></tr><tr><td>&nbsp;</td> </tr> <tr>
    <td bgcolor=""#00CC33""> <p><font color=""#000000"">You have recieved the
    following link from <font face=""Courier New, Courier, mono"" size=""3"">" &
    fromaddress & "</font></font></p> <p>&nbsp;</p></td> </tr>
    <tr> <td><p>Message:</p> <p><font face=""Courier New,
    Courier, mono"" size=""3"">" & message&"</font></p></td> </tr>
    <tr> <td>Click on the following to access the sent link:<font
    color=""#3300FF""> <a href=""http://site.com/friend.htm""><font
    face=""Arial, Helvetica, sans-serif"" size=""4"">Camp
    Shane</font></a></font></td> </tr> <tr>
    <td>&nbsp;</td> </tr> </table> <p align=""center""><input
    type=""button"" value=""Close Window"" name=""close""
    onClick=""window.close()""></p></td> </tr></table></body></html>"

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


    Const cdoSendUsingPort = 2

    Set objCDO = Server.CreateObject("CDO.Message")
    Set iConf = Server.CreateObject("CDO.Configuration")

    Set Flds = iConf.Fields
    With Flds
    .Item(cdoSendUsingMethod) = cdoSendUsingPort
    .Item(cdoSMTPServer) = "mail-fwd"
    .Item(cdoSMTPServerPort) = 25
    .Item(cdoSMTPconnectiontimeout) = 10
    .Update
    End With

    Set objCDO.Configuration = iConf

    objCDO.From = fromWho
    objCDO.To = toWho
    objCDO.Subject = "A friend of yours thought that you may be interested in
    http://www.site.com"
    objCDO.TextBody = msg
    objCDO.Send

    END SUB
    fromWho = TRIM( Request.Form( "fromWho") )
    toWho = TRIM( Request.Form( "toWho") )
    Subject = TRIM( Request.Form( "Subject" ) )
    msg = TRIM( Request.Form( "msg") )
    If toWho <> "" THEN
    sendMail fromWho, toWho, Subject, msg


    'Cleanup
    Set ObjCDO = Nothing
    Set iConf = Nothing
    Set Flds = Nothing
    Response.redirect "http://www.site.com"
    ' Any existing page can be used for the response redirect method
    END IF
    %>



    <HTML>
    <HEAD><TITLE>Email Form</TITLE><meta http-equiv="Content-Type"
    content="text/html; charset="></HEAD>
    <body bgcolor="#33ff33">
    <FORM METHOD="POST" ACTION="<%=Request.ServerVariables("SCRIPT_NAME")% >">
    <table width="400" border="1" bordercolor="#000000" height="309">
    <tr>
    <td valign="top" height="303">
    <table width="100%" border="0">
    <tr>
    <td colspan="2"> <p align="center"><font color="#000000">EMAIL
    this
    page to a friend</font></p></td>
    </tr>
    <tr>
    <td colspan="2">
    <div align="center"><strong>web site</strong></div>
    </td>
    </tr>
    <tr>
    <td colspan="2"> <p align="center">&nbsp;</p></td>
    </tr>
    <tr>
    <td width="39%"><font size="-1">Your friends email
    address:</font></td>
    <td width="61%"> <font size="-1">
    <input name="towho" type="text" id="towho">
    </font> </td>
    </tr>
    <tr>
    <td><font color="#000000" size="-1">Your email
    address:</font></td>
    <td>
    <input name="fromwho" type="text" id="fromwho">
    </td>
    </tr>
    <tr>
    <td colspan="2"><font size="-1">Message:</font></td>
    </tr>
    <tr>
    <td colspan="2">
    <textarea name="body" cols="40" rows="5" id="body"></textarea>
    </td>
    </tr>
    <tr>
    <td colspan="2"><table width="100%" border="0">
    <tr>
    <td><div align="center">
    <input type="reset" name="Reset" value="Reset">
    </div></td>
    <td><div align="center">
    <input type="submit" name="Submit2" value="Submit">

    </div></td>
    </tr>
    </table></td>
    </tr>
    </table>
    <p align="center">&nbsp;</p>
    </td>
    </tr>
    </table>
    </FORM>
    </HTML>


    David Guest

  2. Similar Questions and Discussions

    1. Complex Formatting Issue
      Hello all- I have some code I am using that I got from these forums and its working wonderfully. However, now I need it to do something a little...
    2. Mail formatting problem
      I'm using this code below. It sends the emails ok but none ofthe body isformatted. Any ideas? Thanks Andy <% Dim BodyString
    3. E-mail formatting?
      When e-mailing invoices and estimates, is there any way to customize the presentation of the e-mail beyond changing the message? Specifically, I'd...
    4. Need help formatting query for mail()
      I want to use mail() to send a message to a group of addresses in a mysql table. Išve got my mail script and my sql query, but I donšt know how to...
    5. Date Formatting Issue
      I have Access 2000. On a form, I want to show (in an unbound text box) how long an agreement has been effect, and format it in years and days. ...
  3. #2

    Default Re: CDO mail formatting issue

    try out some of these examples..
    they all seem to work well for me

    [url]http://www.powerasp.com/content/new/sending_email_cdosys.asp[/url]




    "David" <dross@si.rr.com> wrote in message
    news:OLk34K5QFHA.244@TK2MSFTNGP12.phx.gbl...
    > Hi, When I set the following for my CDO email, the mail is receievd with
    > the html portion does not appear formatted but just as it is seen below.
    > I seperated the problem area below with a dashed line to make it easier to
    > find in this post.
    >
    > Any suggestions would be appreciated.
    >
    > Thanks
    > David
    >
    >
    >
    >
    >
    > <!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
    > NAME="CDO for Windows Library" -->
    >
    > <!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4"
    > NAME="ADODB Type Library" -->
    > <%
    > SUB sendmail( fromWho, toWho, Subject, Body )
    >
    > Dim objCDO
    > Dim iConf
    > Dim Flds
    > Dim msg
    > -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    > msg="<html><head><title>E-Mail Link</title><meta
    > http-equiv=""Content-Type"" content=""text/html;
    > charset=iso-8859-1""></head><body bgcolor=""#33FF33""><table width=""400""
    > height=""300"" border=""1"" bordercolor=""#000000"" bgcolor=""#33FF33"">
    > <tr><td><table width=""100%"" border=""0""><tr><td><div
    > align=""center""><a href=""http://site.com/friend.htm""><img
    > src=""http://site.com/images/e_header.gif"" width=""397""
    > height=""101""></a></div></td></tr><tr><td>&nbsp;</td> </tr>
    > <tr> <td bgcolor=""#00CC33""> <p><font color=""#000000"">You have
    > recieved the following link from <font face=""Courier New, Courier, mono""
    > size=""3"">" & fromaddress & "</font></font></p> <p>&nbsp;</p></td>
    > </tr> <tr> <td><p>Message:</p> <p><font
    > face=""Courier New, Courier, mono"" size=""3"">" &
    > message&"</font></p></td> </tr> <tr> <td>Click on the
    > following to access the sent link:<font color=""#3300FF""> <a
    > href=""http://site.com/friend.htm""><font face=""Arial, Helvetica,
    > sans-serif"" size=""4"">Camp Shane</font></a></font></td> </tr>
    > <tr> <td>&nbsp;</td> </tr> </table> <p
    > align=""center""><input type=""button"" value=""Close Window""
    > name=""close"" onClick=""window.close()""></p></td>
    > </tr></table></body></html>"
    >
    > -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    >
    >
    > Const cdoSendUsingPort = 2
    >
    > Set objCDO = Server.CreateObject("CDO.Message")
    > Set iConf = Server.CreateObject("CDO.Configuration")
    >
    > Set Flds = iConf.Fields
    > With Flds
    > .Item(cdoSendUsingMethod) = cdoSendUsingPort
    > .Item(cdoSMTPServer) = "mail-fwd"
    > .Item(cdoSMTPServerPort) = 25
    > .Item(cdoSMTPconnectiontimeout) = 10
    > .Update
    > End With
    >
    > Set objCDO.Configuration = iConf
    >
    > objCDO.From = fromWho
    > objCDO.To = toWho
    > objCDO.Subject = "A friend of yours thought that you may be interested in
    > http://www.site.com"
    > objCDO.TextBody = msg
    > objCDO.Send
    >
    > END SUB
    > fromWho = TRIM( Request.Form( "fromWho") )
    > toWho = TRIM( Request.Form( "toWho") )
    > Subject = TRIM( Request.Form( "Subject" ) )
    > msg = TRIM( Request.Form( "msg") )
    > If toWho <> "" THEN
    > sendMail fromWho, toWho, Subject, msg
    >
    >
    > 'Cleanup
    > Set ObjCDO = Nothing
    > Set iConf = Nothing
    > Set Flds = Nothing
    > Response.redirect "http://www.site.com"
    > ' Any existing page can be used for the response redirect method
    > END IF
    > %>
    >
    >
    >
    > <HTML>
    > <HEAD><TITLE>Email Form</TITLE><meta http-equiv="Content-Type"
    > content="text/html; charset="></HEAD>
    > <body bgcolor="#33ff33">
    > <FORM METHOD="POST" ACTION="<%=Request.ServerVariables("SCRIPT_NAME")% >">
    > <table width="400" border="1" bordercolor="#000000" height="309">
    > <tr>
    > <td valign="top" height="303">
    > <table width="100%" border="0">
    > <tr>
    > <td colspan="2"> <p align="center"><font color="#000000">EMAIL
    > this
    > page to a friend</font></p></td>
    > </tr>
    > <tr>
    > <td colspan="2">
    > <div align="center"><strong>web site</strong></div>
    > </td>
    > </tr>
    > <tr>
    > <td colspan="2"> <p align="center">&nbsp;</p></td>
    > </tr>
    > <tr>
    > <td width="39%"><font size="-1">Your friends email
    > address:</font></td>
    > <td width="61%"> <font size="-1">
    > <input name="towho" type="text" id="towho">
    > </font> </td>
    > </tr>
    > <tr>
    > <td><font color="#000000" size="-1">Your email
    > address:</font></td>
    > <td>
    > <input name="fromwho" type="text" id="fromwho">
    > </td>
    > </tr>
    > <tr>
    > <td colspan="2"><font size="-1">Message:</font></td>
    > </tr>
    > <tr>
    > <td colspan="2">
    > <textarea name="body" cols="40" rows="5"
    > id="body"></textarea>
    > </td>
    > </tr>
    > <tr>
    > <td colspan="2"><table width="100%" border="0">
    > <tr>
    > <td><div align="center">
    > <input type="reset" name="Reset" value="Reset">
    > </div></td>
    > <td><div align="center">
    > <input type="submit" name="Submit2" value="Submit">
    >
    > </div></td>
    > </tr>
    > </table></td>
    > </tr>
    > </table>
    > <p align="center">&nbsp;</p>
    > </td>
    > </tr>
    > </table>
    > </FORM>
    > </HTML>
    >
    >

    Kyle Peterson Guest

  4. #3

    Default Re: CDO mail formatting issue

    Hi,

    can anyone help me to add MSFlexGrid control in asp page to display the ADO
    Recordset value.

    Here i am trying but i am not getting the proper output in the grid, istead
    of that i am getting the following output,

    MSFlexGrid1.Rows=0 MSFlexGrid1.Cols=31 MSFlexGrid1.Row=0 MSFlexGrid1.Col=0
    MSFlexGrid1.Text="ExchCode" MSFlexGrid1.Col=1
    MSFlexGrid1.Text="ContractDate" MSFlexGrid1.Col=2 MSFlexGrid1.Text="SetID"
    MSFlexGrid1.Col=3 MSFlexGrid1.Text="SetNo" MSFlexGrid1.Col=4
    MSFlexGrid1.Text="ClientCode" MSFlexGrid1.Col=5
    MSFlexGrid1.Text="ClientName" MSFlexGrid1.Col=6 MSFlexGrid1.Text="ScripCode"
    MSFlexGrid1.Col=7 MSFlexGrid1.Text="UnderLyingScripName" MSFlexGrid1.Col=8
    MSFlexGrid1.Text="BuySellFlag" MSFlexGrid1.Col=9
    MSFlexGrid1.Text="PrintControlNo" MSFlexGrid1.Col=10
    MSFlexGrid1.Text="ContractNo" MSFlexGrid1.Col=11 MSFlexGrid1.Text="Qty"
    MSFlexGrid1.Col=12 MSFlexGrid1.Text="ExecRate" MSFlexGrid1.Col=13
    MSFlexGrid1.Text="NetRate" MSFlexGrid1.Col=14 MSFlexGrid1.Text="InstCode"
    MSFlexGrid1.Col=15 MSFlexGrid1.Text="StrikePrice" MSFlexGrid1.Col=16
    MSFlexGrid1.Text="ExpiryDate" MSFlexGrid1.Col=17
    MSFlexGrid1.Text="Optiontype" MSFlexGrid1.Col=18
    MSFlexGrid1.Text="UnderlyingInstrument" MSFlexGrid1.Col=19

    regards,
    Mullai Ilamaran AM


    Mullai Guest

Posting Permissions

  • You may not post new threads
  • You may 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