SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: CDOSYS HTMLBody

  1. #1
    SitePoint Zealot Grantspad69's Avatar
    Join Date
    Jun 2003
    Location
    UK
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CDOSYS HTMLBody

    Hi,

    I'm having difficulty sending a HTML Newsletter via the CDOSYS email function.

    The emails are sending successfully and are received in the inbox of all email clients.

    However, when the email is received, some lines of the HTML newsletter template are missing.

    I am using the “strMailMessage” and “footer” string variables to populate the newsletter template.

    Is there a maximum character length a string variable can contain and could this be the reason why some lines of the HTML are missing?

    Any suggestions gratefully received

    Code:
    - - - - - - - - - - - - - HTML BODY CONTENT - - - - - - - - - - - - - - -
    
    
    dim strMailMessage, footer
    
    strMailMessage = strMailMessage & "<META HTTP-EQUIV=""Content-Type"" CONTENT=""text/html;charset=iso-8859-1"">"
    strMailMessage = strMailMessage & "<html><head>"
    strMailMessage = strMailMessage & "<title>" & strMailSubject & "</title>"
    strMailMessage = strMailMessage & "<style>" 
    strMailMessage = strMailMessage & "body {" 
    strMailMessage = strMailMessage & "margin-left: 20px;" 
    strMailMessage = strMailMessage & "font-family: Arial;"
    strMailMessage = strMailMessage & "font-size: 11px;"
    strMailMessage = strMailMessage & "background-position: left top;"
    strMailMessage = strMailMessage & "color: #000000;"
    strMailMessage = strMailMessage & "background-repeat: no-repeat;"
    strMailMessage = strMailMessage & "}"
    strMailMessage = strMailMessage & "hr {"
    strMailMessage = strMailMessage & "color: #1A59A8;"
    strMailMessage = strMailMessage & "}"
    strMailMessage = strMailMessage & "</style>"
    strMailMessage = strMailMessage & "</head>"
    strMailMessage = strMailMessage & "<body>"
    	
    strMailMessage = strMailMessage & "<table width=""585"" border=""0"" align=""center"" "
    strMailMessage = strMailMessage & "cellpadding=""0"" cellspacing=""0"">"
    strMailMessage = strMailMessage & "<tr>"
    strMailMessage = strMailMessage & "<td valign=""top"" style=""padding:20px;"">" 
    strMailMessage = strMailMessage & "<font size=""2"" face=""Arial, Helvetica, sans-serif""><p>Hi,</p><p>"
    strMailMessage = strMailMessage & rsNewletter.Fields.Item("NewsletterMessage").Value
    strMailMessage = strMailMessage & "</p><p>Regards,<br />Client</p></font></td>"
    strMailMessage = strMailMessage & "</tr>"
    strMailMessage = strMailMessage & "<tr>"
    strMailMessage = strMailMessage & "<td height=""20"" valign=""top"" bgcolor=""#0B326B"" style=""padding-left:20px;"
    strMailMessage = strMailMessage & " padding-bottom:5px; padding-top:5px;"">"
    strMailMessage = strMailMessage & "<font face=""Arial, Helvetica, sans-serif"" size=""2"" color=""#FFFFFF"">"
    strMailMessage = strMailMessage & "<b>" & rsShows.Fields.Item("ShowTitle").Value & "</b></font></td></tr>"
    strMailMessage = strMailMessage & "<tr><td valign=""top"" style=""padding:20px;"">"
    strMailMessage = strMailMessage & "<img src=""http://www.domain.com/images/pic.jpg"" "
    strMailMessage = strMailMessage & "width=""230"" height=""264"" align=""left"" style=""margin-right:20px;"">"
    strMailMessage = strMailMessage & "<font face=""Arial, Helvetica, sans-serif"" size=""2"">"
    strMailMessage = strMailMessage & "<p>" & rsShows.Fields.Item("ShowSubtitle").Value & "</p>"
    strMailMessage = strMailMessage & "<p>" & rsShows.Fields.Item("ShowBodyText").Value & "</p></font></td></tr>"
    strMailMessage = strMailMessage & "<tr><td valign=""top"">"
    strMailMessage = strMailMessage & "<img src=""http://www.domain.com/images/footer_line.gif"" "
    strMailMessage = strMailMessage & "width=""585"" height=""5""></td>"
    strMailMessage = strMailMessage & "</tr>"
    strMailMessage = strMailMessage & "<tr align=""center"">"
    strMailMessage = strMailMessage & "<td valign=""top"" style=""padding:5px;"">"
    strMailMessage = strMailMessage & "<p><br /></p>"
    strMailMessage = strMailMessage & "<p><font face=""Arial, Helvetica, sans-serif"" size=""2"">"
    strMailMessage = strMailMessage & "This email was sent to you by xxxxxxxxxxxxxx"
    strMailMessage = strMailMessage & "<br /><br /><b><font color=""#CC0000"">tel:</font></b>"
    strMailMessage = strMailMessage & "&nbsp;xxxxxxxxxxxxxx&nbsp;&nbsp;"
    strMailMessage = strMailMessage & "<b><font color=""#CC0000"">fax:</font></b>&nbsp;xxxxxxxxxxxxxxx&nbsp;&nbsp; <b>"
    strMailMessage = strMailMessage & "<font color=""#CC0000""><br />email:</font></b>"
    strMailMessage = strMailMessage & "&nbsp;<a href=""mailto:admin@domain.com"">admin@domain.com</a>"
    strMailMessage = strMailMessage & "&nbsp;&nbsp; <b><font color=""#CC0000"">web:</font></b>&nbsp;"
    strMailMessage = strMailMessage & "<a href=""http://www.domain.com"" target=""_blank"">"
    strMailMessage = strMailMessage & "www.domain.com</a>"
    strMailMessage = strMailMessage & "<br /><br /></font></p></td></tr>"
    strMailMessage = strMailMessage & "<tr>"
    strMailMessage = strMailMessage & "<td height=""128"" valign=""top"" style=""padding:10px;"">"
    strMailMessage = strMailMessage & "<div align=""left"">"
    strMailMessage = strMailMessage & "<font size=""1"" color=""#666666"">Any offer contained in" 
    strMailMessage = strMailMessage & "this email (or attachment) does not "
    strMailMessage = strMailMessage & "constitute a contract.<br /><br />"
    	
    footer = footer & "Disclaimer: The information contained in" 
    footer = footer & "this e-mail and any files transmitted with it are" 
    footer = footer & "confidential and intended solely for the"
    footer = footer & "use of the individual or entity to whom they are addressed." 
    footer = footer & "If you are not the intended recipient or have received this" 
    footer = footer & "communication in error, please notify the sender by e-mail "
    footer = footer & "or telephone xxxxx xxxxxx" 
    footer = footer & "and delete it from your system and destroy any copies of it." 
    footer = footer & "Any copying, retransmission, distribution, action taken, or "
    footer = footer & "omitted to be taken, in"
    footer = footer & "reliance upon it is strictly prohibited and may be unlawful." 
    footer = footer & "Please note that whilst steps have been taken by xxxxxxx" 
    footer = footer & "ensure that this e-mail and attachments are virus free, " 
    footer = footer & "neither xxxxxxxxxxx nor" 
    footer = footer & "the sender accepts responsibility for viruses and the recipient" 
    footer = footer & "should ensure that the e-mail and attachments (if any) "
    footer = footer & "are actually virus free."
    footer = footer & "We make all reasonable efforts to ensure that all" 
    footer = footer & "information provided by us"
    footer = footer & "in connection with this email is accurate at the time of its inclusion;" 
    footer = footer & "however, there may be errors, inaccuracies or" 
    footer = footer & "omissions in respect of which we" 
    footer = footer & "exclude all liability. We make no representations or warranties about the" 
    footer = footer & "information included (including links to third parties' web pages)." 
    footer = footer & "You shall be solely responsible for any decisions based on the" 
    footer = footer & "information contained on such web pages."
    footer = footer & "</font></div></td></tr></table>" 
    footer = footer & "</body>"
    footer = footer & "</html>"
    %>
    
    
    - - - - - - - - - - - - - SEND MAIL - - - - - - - - - - - - - - -
    
    With iMsg
      Set .Configuration = iConf
          .To       = "Recipient@domain.com"
          .From     =  "sender@domain.com>"
          .Subject = "subject text"
          .HTMLBody = strMailMessage & footer
          .Send
    End With
    %>

  2. #2
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    since your using cdosys why don't you create a template, then use cdosys.CreateMHTMLBody "http://www.domain.com/newsletter/template.asp?header=" & rsNewsletter("header") & "&body=" & rsNewsletter("body") & "id=" & rsNewsletter("id") & " etc

    then in your template, create it, have it look the way you want it, but make sure you stick the css inside the page, rather then linking as this wont work. Also, make sure you link the images directly to the source rather then ../images.

    Once your done, then add <%= request.querystring("body") %> where you want the body, etc

    save it, link the script up to hit that page. Send. What it will do is it will call that page with the querystrings, the page will fill up with the data you have given it, then the script will send that page with the information all in. Meaning you don't have to change the page.

    When it comes to editting the page, it means you don't have to fanny on with the script.

    Gav


  3. #3
    SitePoint Zealot Grantspad69's Avatar
    Join Date
    Jun 2003
    Location
    UK
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Gav,

    I have tried the CreateMHTMLBody method and when the newsletter is sent, it is successfully received in Outlook and GMail but in other mail clients, such as Hotmail, the images are not embedded and do not display. They are just listed as attachments.

    Is there any way to prevent this from happening?

  4. #4
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    not sure.. i'll have a look and let you know,

    Gav


  5. #5
    SitePoint Zealot Grantspad69's Avatar
    Join Date
    Jun 2003
    Location
    UK
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    much appreciated Gav

  6. #6
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    to be honest mate, I've never had this issue. Erm. With hotmail I know you can turn images on and off. Could this be the issue?

    If not i know no way of know how to do it until your sending your images like this: <img src="../images/image.gif"> instead of <img src="http://domain.com/images/image.gif"> also you could try <embed src="http://domain.com/images/image.gif"> let me know what happens mate.

    Gav



Bookmarks

Posting Permissions

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