Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Cdonts and desgin of the email

I can send emails by cdonts but I do not how to include images in those emails. My web site has a stylesheet page that controls all pages of the site, I want to be able to relate the email to this stylesheet that is located on the server and I want to be able to add an image at the top of the email page. Can any body help me with this.

Thanks in advance

Comments

  • lillulillu Posts: 308Member
    http://authors.aspalliance.com/chrisg/default.asp?article=104

    : I can send emails by cdonts but I do not how to include images in those emails. My web site has a stylesheet page that controls all pages of the site, I want to be able to relate the email to this stylesheet that is located on the server and I want to be able to add an image at the top of the email page. Can any body help me with this.
    :
    : Thanks in advance
    :
    :

    [hr][grey]To err is human, but to really foul things up requires a computer. (Farmers Almanac)[/grey] :-)

  • rasharasha Posts: 25Member
    Thanks much for your help but when I visited your link and tried to use the demo it did not work and it did not. I tried to make it from my server but still it did not work . I change the line 50 to look to my image but it did not work too
    objMail.AttachURL server.MapPath("imagesannerasket.jpg"), "logo.gif"

    any help?
    Also I wonder if you can tell me how to embed the style sheet fie that controls the colors of the site to control the colors of the email message too.

    Thank you

  • ManningManning Posts: 1,621Member
    : Thanks much for your help but when I visited your link and tried to use the demo it did not work and it did not. I tried to make it from my server but still it did not work . I change the line 50 to look to my image but it did not work too
    : objMail.AttachURL server.MapPath("imagesannerasket.jpg"), "logo.gif"
    :
    : any help?

    The second parameter has to be the name you are attaching the file as, which means it must correspond to the image tag in your email. If you did not reference it as image in your message, then that is why it did not work.
  • rasharasha Posts: 25Member
    Hello Manning,
    I have tried yor answer but nothing worked. Here is my code, I will be vwry thankfull to you if find the error to me





    <%

    if request.ServerVariables("REQUEST_METHOD") = "GET" then

    %>



    Your Name Your EMail


    Recipient Email


    Your message







    <%

    else

    Set objMail = Server.CreateObject("CDONTS.NewMail")
    objMail.Importance = 1
    objMail.From = request("strName") & "<" & request("strEmail") & ">"
    objMail.To = request("strTo")
    objMail.Subject = "Example of HTML EMail with Embeded Image"

    ' this is my messages HTML
    strMsg = "" & _
    "" & _
    "" & _
    "
    Example of a HTML Email with embedded Image
    " & _
    request("message") & _
    ""

    ' set the format of the email to html, etc
    objMail.BodyFormat = 0
    objMail.MailFormat = 0
    objMail.Body = strMsg

    ' attach our image file and set the url to simply logo.gif
    objMail.AttachURL server.MapPath("imagesannerasket.jpg"), "logo.gif"
    objMail.Send

    ' destroy the email object
    Set objMail = Nothing

    %>

    Message Sent, Thanks!


    <% end if %>



    Thanks a lot
    Rasha, Egypt

  • ManningManning Posts: 1,621Member
    : Hello Manning,
    : I have tried yor answer but nothing worked. Here is my code, I will be vwry thankfull to you if find the error to me
    :
    :
    :
    :
    :
    : <%
    :
    : if request.ServerVariables("REQUEST_METHOD") = "GET" then
    :
    : %>
    :
    :
    :
    : Your Name Your EMail
    :
    : Recipient Email
    :
    :
    : Your message
    :
    :
    :
    :
    :
    :
    :
    : <%
    :
    : else
    :
    : Set objMail = Server.CreateObject("CDONTS.NewMail")
    : objMail.Importance = 1
    : objMail.From = request("strName") & "<" & request("strEmail") & ">"
    : objMail.To = request("strTo")
    : objMail.Subject = "Example of HTML EMail with Embeded Image"
    :
    : ' this is my messages HTML
    : strMsg = "" & _
    : "" & _
    : "" & _
    : "
    Example of a HTML Email with embedded Image" & _
    : request("message") & _
    : ""
    :
    : ' set the format of the email to html, etc
    : objMail.BodyFormat = 0
    : objMail.MailFormat = 0
    : objMail.Body = strMsg
    :
    : ' attach our image file and set the url to simply logo.gif
    : objMail.AttachURL server.MapPath("imagesannerasket.jpg"), "[red]logo.gif[/red]"
    : objMail.Send
    :
    : ' destroy the email object
    : Set objMail = Nothing
    :
    : %>
    :
    : Message Sent, Thanks!
    :
    :
    : <% end if %>
    :
    :


    I've never embedded images, but I'll bet the problem is that you have to synchronize the two things I marked in red above. Don't provide a path to the image, and make sure you use the same filename on both lines.
  • vanithvanith Posts: 44Member
    I hope Manning's reply would have solved your problem.
    I was just curious to know if you tried the fully resolved URL in the IMG tag as


    [code]
    strMsg = "" & _
    : "" & _
    : "" & _
    : "

    Example of a HTML Email with embedded Image" & _
    : request("message") & _
    : ""
    [/code]

    In this case, you do not need to AttachURL any images. When the user opens his email [Online], the image is loaded into his mail automatically from the website.

    :)heers,
    Vanith

  • ManningManning Posts: 1,621Member
    : I hope Manning's reply would have solved your problem.
    : I was just curious to know if you tried the fully resolved URL in the IMG tag as
    :
    :
    : [code]
    : strMsg = "" & _
    : : "" & _
    : : "" & _
    : : "

    Example of a HTML Email with embedded Image" & _
    : : request("message") & _
    : : ""
    : [/code]
    :
    : In this case, you do not need to AttachURL any images. When the user opens his email [Online], the image is loaded into his mail automatically from the website.


    This is heresay, but I've heard most e-mail clients don't allow external images to be loaded. For example, I could embed the following string into an email:

    image

    The ID number would be unique to each recipient of the message, and could correspond to their email address in a database. That spamlist.cgi could update a record in that database, effectively saying "the e-mail address that corresponds to ID 100 is active, because the recipient of this e-mail just tried to retrieve an image hosted on my server".

    Now the spammers can keep pretty accurate records of how many targets their spam is actually reaching.

  • rasharasha Posts: 25Member
    [b][red]This message was edited by rasha at 2003-12-6 23:26:0[/red][/b][hr]
    Hi,

    Thanks for both of you Manning and vanith for your help, I have tried both of your solutions but nothing work.

    As for the Manning solution, you have colored in red to parts of code, the first part gives the path of the image but the second part does not do the same job so we do not need to synchronize them (instead it gives the alt or the alternative text that appears on the image and this is any text you just type.

    As for the vanith solution, I tried the fully resolved URL in the IMG tag but it did not work and i do not know why.

    If any there are more ideas I will appreciate it.

    Thanks


  • ManningManning Posts: 1,621Member
    : As for the Manning solution, you have colored in red to parts of code, the first part gives the path of the image but the second part does not do the same job so we do not need to synchronize them (instead it gives the alt or the alternative text that appears on the image and this is any text you just type.


    [Green]Did you even try to make the suggested change, or are you just assuming it is wrong? All this time I have been making the assumption that what I was saying is correct, so after you said that I thought I should look it up to know for sure. And as I suspected, this source backs up my theory:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/_denali_attachurl_method_cdonts_newmail_object_.asp[/Green]


    : As for the vanith solution, I tried the fully resolved URL in the IMG tag but it did not work and i do not know why.


    [Green]Probably for the reason I said in my reply (privacy issues)[/Green]
Sign In or Register to comment.