Embed image in CDOSYS message

Discussion in 'ASP General' started by Manuel, Jul 13, 2006.

  1. Manuel

    Manuel Guest

    Is it possible to embed an image, like a company logo in a CDOSYS generated
    message?
    If yes, I´ll apreciate some code sample. I´ve been able to format messages
    in html the way I like, but I can't figure out how to embed an image.
    Thanks for your time.

    --
    Manuel
     
    Manuel, Jul 13, 2006
    #1
    1. Advertising

  2. Manuel

    James Jones Guest

    well since u kno how to embed HTML, just use the the img tag


    connName.HTMLBody = "<img src=""URL TO IMAGE"" height=""XX"" width=""XX"">



    change the connName to ur connection name.
    change URL TO IMAGE to the link to ur images u wanna embed.

    change height and width as needed. if ur not gonna mess with these
    attributes, then just remove them.


    note that i have used 2 sets of quoation marks on each side of the value.

    "URL TO IMAGE"

    will throw you an error, and will not send ur message.


    ""URL TO IMAGE""


    is the correct format.


    Hope this helps
    Jay







    "Manuel" <> wrote in message
    news:...
    > Is it possible to embed an image, like a company logo in a CDOSYS
    > generated
    > message?
    > If yes, I´ll apreciate some code sample. I´ve been able to format messages
    > in html the way I like, but I can't figure out how to embed an image.
    > Thanks for your time.
    >
    > --
    > Manuel
     
    James Jones, Jul 13, 2006
    #2
    1. Advertising

  3. Manuel

    Manuel Guest

    Thanks for your help James. I think we're almos there. What's happening now
    is that the message that is sent and I Cc it to myself, comes up in outlook
    with that protection asking to right click the image to see it. But when I do
    that, nothing happens and the option of the right click to see the image
    disappears. Any ideas.
    Thanks a million
    --
    Manuel


    "James Jones" wrote:

    > well since u kno how to embed HTML, just use the the img tag
    >
    >
    > connName.HTMLBody = "<img src=""URL TO IMAGE"" height=""XX"" width=""XX"">
    >
    >
    >
    > change the connName to ur connection name.
    > change URL TO IMAGE to the link to ur images u wanna embed.
    >
    > change height and width as needed. if ur not gonna mess with these
    > attributes, then just remove them.
    >
    >
    > note that i have used 2 sets of quoation marks on each side of the value.
    >
    > "URL TO IMAGE"
    >
    > will throw you an error, and will not send ur message.
    >
    >
    > ""URL TO IMAGE""
    >
    >
    > is the correct format.
    >
    >
    > Hope this helps
    > Jay
    >
    >
    >
    >
    >
    >
    >
    > "Manuel" <> wrote in message
    > news:...
    > > Is it possible to embed an image, like a company logo in a CDOSYS
    > > generated
    > > message?
    > > If yes, I´ll apreciate some code sample. I´ve been able to format messages
    > > in html the way I like, but I can't figure out how to embed an image.
    > > Thanks for your time.
    > >
    > > --
    > > Manuel

    >
    >
    >
     
    Manuel, Jul 13, 2006
    #3
  4. Manuel

    James Jones Guest

    mayb the image URL is incorrect...

    verify every path is correct everywhere.......make sure u can view images in
    outlook as well.




    "Manuel" <> wrote in message
    news:...
    > Thanks for your help James. I think we're almos there. What's happening
    > now
    > is that the message that is sent and I Cc it to myself, comes up in
    > outlook
    > with that protection asking to right click the image to see it. But when I
    > do
    > that, nothing happens and the option of the right click to see the image
    > disappears. Any ideas.
    > Thanks a million
    > --
    > Manuel
    >
    >
    > "James Jones" wrote:
    >
    >> well since u kno how to embed HTML, just use the the img tag
    >>
    >>
    >> connName.HTMLBody = "<img src=""URL TO IMAGE"" height=""XX""
    >> width=""XX"">
    >>
    >>
    >>
    >> change the connName to ur connection name.
    >> change URL TO IMAGE to the link to ur images u wanna embed.
    >>
    >> change height and width as needed. if ur not gonna mess with these
    >> attributes, then just remove them.
    >>
    >>
    >> note that i have used 2 sets of quoation marks on each side of the value.
    >>
    >> "URL TO IMAGE"
    >>
    >> will throw you an error, and will not send ur message.
    >>
    >>
    >> ""URL TO IMAGE""
    >>
    >>
    >> is the correct format.
    >>
    >>
    >> Hope this helps
    >> Jay
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >> "Manuel" <> wrote in message
    >> news:...
    >> > Is it possible to embed an image, like a company logo in a CDOSYS
    >> > generated
    >> > message?
    >> > If yes, I´ll apreciate some code sample. I´ve been able to format
    >> > messages
    >> > in html the way I like, but I can't figure out how to embed an image.
    >> > Thanks for your time.
    >> >
    >> > --
    >> > Manuel

    >>
    >>
    >>
     
    James Jones, Jul 13, 2006
    #4
  5. Manuel

    Manuel Guest

    James,
    I´m pasting the code that I have now. I hope you bypass the portuguese
    language issue.
    As you can see, this is a confirmation message of the record insertion in
    SQL2000 Server database. I hope this will help you better in your guidance.
    Everything works just fine except for the image part as I´ve described in
    the previous post.
    Thanks again for your pacience.

    <%
    Dim Recordset1
    Dim Recordset1_numRows

    Set Recordset1 = Server.CreateObject("ADODB.Recordset")
    Recordset1.ActiveConnection = MM_Iterartis_Web_STRING
    Recordset1.Source = "SELECT ID, Nome, Cidade, Pais, Email, Telefone,
    Telemovel, Nome_Contacto, Data_Prevista, Cidade_Origem, Cidade_Destino,
    Descricao_Conteudos FROM dbo.contacto_tbl ORDER BY ID DESC"
    Recordset1.CursorType = 0
    Recordset1.CursorLocation = 2
    Recordset1.LockType = 1
    Recordset1.Open()

    Recordset1_numRows = 1

    Dim strNome, strCidade, strPais, strEmail, strTelefone, strTelemovel,
    strContacto, strDataPrevista, strCidadeOrigem, strCidadeDestino,
    strDescricao, strImage
    Dim strBody

    strNome = Recordset1("Nome")
    strCidade = Recordset1("Cidade")
    strPais = Recordset1("Pais")
    strEmail = Recordset1("Email")
    strTelefone = Recordset1("Telefone")
    strTelemovel = Recordset1("Telemovel")
    strContacto = Recordset1("Nome_Contacto")
    strDataPrevista = Recordset1("Data_Prevista")
    strCidadeOrigem = Recordset1("Cidade_Origem")
    strCidadeDestino = Recordset1("Cidade_Destino")
    strDescricao = Recordset1("Descricao_Conteudos")

    strBody = strBody & "<img src=""/images/Logo.gif""/>" & "<br>" & "<br>"

    strBody = strBody & "<strong><font face=""Verdana"" size=""1""
    color=""#DC241F"">Formulário que nos foi enviado na
    Data/Hora:</font></strong></td>" & "<font face=""Verdana"" size=""1""
    color=""#000000"">"& " " & Now() & vbCrLf & "<br><br>" & "</font>"

    strBody = strBody & "<strong><font face=""Verdana"" size=""1""
    color=""#DC241F"">From:</font></strong>" & "<font face=""Verdana"" size=""1""
    color=""#000000"">&nbsp;http://" & Request.ServerVariables("HTTP_HOST") &
    vbCrLf & "<br>" & "<br>" & "</font>"

    strBody = strBody & "<strong><font face=""Verdana"" size=""1""
    color=""#DC241F"">IP:</font></strong> " & "<font face=""Verdana"" size=""1""
    color=""#000000"">" & " " & Request.ServerVariables("REMOTE_ADDR") & vbCrLf &
    "<br>" & "<br>" & "</font>"

    strBody = strBody & "<strong><font face=""Verdana"" size=""1""
    color=""#DC241F"">Nome:</font></strong>" & "<font face=""Verdana"" size=""1""
    color=""#000000"">" & " " & strNome &"<br>" & "<br>" & "</font>"

    strBody = strBody & "<strong><font face=""Verdana"" size=""1""
    color=""#DC241F"">Cidade:</font></strong>" & "<font face=""Verdana""
    size=""1"" color=""#000000"">" & " " & strCidade &"<br>" & "<br>" & "</font>"

    strBody = strBody & "<strong><font face=""Verdana"" size=""1""
    color=""#DC241F"">País:</font></strong>" & "<font face=""Verdana"" size=""1""
    color=""#000000"">" & " " & strPais &"<br>" & "<br>" & "</font>"

    strBody = strBody & "<strong><font face=""Verdana"" size=""1""
    color=""#DC241F"">Email:</font></strong>" & "<font face=""Verdana""
    size=""1"" color=""#000000"">" & " " & strEmail &"<br>" & "<br>" & "</font>"

    strBody = strBody & "<strong><font face=""Verdana"" size=""1""
    color=""#DC241F"">Telefone:</font></strong>" & "<font face=""Verdana""
    size=""1"" color=""#000000"">" & " " & strTelefone &"<br>" & "<br>" &
    "</font>"

    strBody = strBody & "<strong><font face=""Verdana"" size=""1""
    color=""#DC241F"">Telemóvel:</font></strong>" & "<font face=""Verdana""
    size=""1"" color=""#000000"">" & " " & strTelemovel &"<br>" & "<br>" &
    "</font>"

    strBody = strBody & "<strong><font face=""Verdana"" size=""1""
    color=""#DC241F"">Nome do Contacto:</font></strong>" & "<font
    face=""Verdana"" size=""1"" color=""#000000"">" & " " & strContacto &"<br>" &
    "<br>" & "</font>"

    strBody = strBody & "<strong><font face=""Verdana"" size=""1""
    color=""#DC241F"">Data Prevista:</font></strong>" & "<font face=""Verdana""
    size=""1"" color=""#000000"">" & " " & strDataPrevista &"<br>" & "<br>" &
    "</font>"

    strBody = strBody & "<strong><font face=""Verdana"" size=""1""
    color=""#DC241F"">Cidade de Origem:</font></strong>" & "<font
    face=""Verdana"" size=""1"" color=""#000000"">" & " " & strCidadeOrigem
    &"<br>" & "<br>" & "</font>"

    strBody = strBody & "<strong><font face=""Verdana"" size=""1""
    color=""#DC241F"">Cidade de Destino:</font></strong>" & "<font
    face=""Verdana"" size=""1"" color=""#000000"">" & " " & strCidadeDestino
    &"<br>" & "<br>" & "</font>"

    strBody = strBody & "<strong><font face=""Verdana"" size=""1""
    color=""#DC241F"">Conteúdos:<br></font></strong>" & "<font face=""Verdana""
    size=""1"" color=""#000000"">" & " " & strDescricao &"<br>" & "<br>"

    strBody = strBody & "</font>"

    Dim ObjSendMail
    Set ObjSendMail = CreateObject("CDO.Message")

    ObjSendMail.To = strEmail
    ObjSendMail.Bcc = ""
    ObjSendMail.Subject = "Confirmação de Pedido de Orçamento"
    ObjSendMail.From = ""

    ' we are sending a html email.. simply switch the comments around to send a
    text email instead
    ObjSendMail.HTMLBody = strBody
    'ObjSendMail.TextBody = strBody

    ObjSendMail.Send

    Set ObjSendMail = Nothing

    %>


    --
    Manuel


    "James Jones" wrote:

    > well since u kno how to embed HTML, just use the the img tag
    >
    >
    > connName.HTMLBody = "<img src=""URL TO IMAGE"" height=""XX"" width=""XX"">
    >
    >
    >
    > change the connName to ur connection name.
    > change URL TO IMAGE to the link to ur images u wanna embed.
    >
    > change height and width as needed. if ur not gonna mess with these
    > attributes, then just remove them.
    >
    >
    > note that i have used 2 sets of quoation marks on each side of the value.
    >
    > "URL TO IMAGE"
    >
    > will throw you an error, and will not send ur message.
    >
    >
    > ""URL TO IMAGE""
    >
    >
    > is the correct format.
    >
    >
    > Hope this helps
    > Jay
    >
    >
    >
    >
    >
    >
    >
    > "Manuel" <> wrote in message
    > news:...
    > > Is it possible to embed an image, like a company logo in a CDOSYS
    > > generated
    > > message?
    > > If yes, I´ll apreciate some code sample. I´ve been able to format messages
    > > in html the way I like, but I can't figure out how to embed an image.
    > > Thanks for your time.
    > >
    > > --
    > > Manuel

    >
    >
    >
     
    Manuel, Jul 13, 2006
    #5
  6. "Manuel" <> wrote in message
    news:...
    > Is it possible to embed an image, like a company logo in a CDOSYS
    > generated
    > message?
    > If yes, I´ll apreciate some code sample. I´ve been able to format messages
    > in html the way I like, but I can't figure out how to embed an image.
    > Thanks for your time.


    What you'd do best, is generate an email thorugh outlook or other program,
    where the emails are embedded.
    Sample. Use IE6 to save a website to a single page!
    Then look at the contents of the page, it will be MIME 1.0 part encoded.

    The MSDN has some samples.
     
    Egbert Nierop \(MVP for IIS\), Jul 13, 2006
    #6
  7. Manuel

    Mike Brind Guest

    You need to host the image on a publicly accessible web server and
    provide the full url in the src attribute:

    <img src=""http://www.domain.pt/images/image.gif"">

    Incidentally, all that string concatentation is terribly wasteful.
    Each time you write strBody = strBody &, the ASP engine has to recreate
    the string from scratch, as well as hold the current value of strBody
    in memory. When I design an html email, I create it in Dreamweaver (or
    some other WYSIWYG editor) then take the resulting html source, pop it
    into word and run a tiny macro I created to double up on double quotes
    and remove paragraphs. That gives me one long unbroken string.

    Or you can use the underscore character:

    strBody = "some text" & _
    "some more text" & _
    "even more text"

    --
    Mike Brind

    Manuel wrote:
    > James,
    > I´m pasting the code that I have now. I hope you bypass the portuguese
    > language issue.
    > As you can see, this is a confirmation message of the record insertion in
    > SQL2000 Server database. I hope this will help you better in your guidance.
    > Everything works just fine except for the image part as I´ve described in
    > the previous post.
    > Thanks again for your pacience.
    >
    > <%
    > Dim Recordset1
    > Dim Recordset1_numRows
    >
    > Set Recordset1 = Server.CreateObject("ADODB.Recordset")
    > Recordset1.ActiveConnection = MM_Iterartis_Web_STRING
    > Recordset1.Source = "SELECT ID, Nome, Cidade, Pais, Email, Telefone,
    > Telemovel, Nome_Contacto, Data_Prevista, Cidade_Origem, Cidade_Destino,
    > Descricao_Conteudos FROM dbo.contacto_tbl ORDER BY ID DESC"
    > Recordset1.CursorType = 0
    > Recordset1.CursorLocation = 2
    > Recordset1.LockType = 1
    > Recordset1.Open()
    >
    > Recordset1_numRows = 1
    >
    > Dim strNome, strCidade, strPais, strEmail, strTelefone, strTelemovel,
    > strContacto, strDataPrevista, strCidadeOrigem, strCidadeDestino,
    > strDescricao, strImage
    > Dim strBody
    >
    > strNome = Recordset1("Nome")
    > strCidade = Recordset1("Cidade")
    > strPais = Recordset1("Pais")
    > strEmail = Recordset1("Email")
    > strTelefone = Recordset1("Telefone")
    > strTelemovel = Recordset1("Telemovel")
    > strContacto = Recordset1("Nome_Contacto")
    > strDataPrevista = Recordset1("Data_Prevista")
    > strCidadeOrigem = Recordset1("Cidade_Origem")
    > strCidadeDestino = Recordset1("Cidade_Destino")
    > strDescricao = Recordset1("Descricao_Conteudos")
    >
    > strBody = strBody & "<img src=""/images/Logo.gif""/>" & "<br>" & "<br>"
    >

    [snipped]

    > Dim ObjSendMail
    > Set ObjSendMail = CreateObject("CDO.Message")
    >
    > ObjSendMail.To = strEmail
    > ObjSendMail.Bcc = ""
    > ObjSendMail.Subject = "Confirmação de Pedido de Orçamento"
    > ObjSendMail.From = ""
    >
    > ' we are sending a html email.. simply switch the comments around to senda
    > text email instead
    > ObjSendMail.HTMLBody = strBody
    > 'ObjSendMail.TextBody = strBody
    >
    > ObjSendMail.Send
    >
    > Set ObjSendMail = Nothing
    >
    > %>
    >
    >
    > --
    > Manuel
    >
    >
    > "James Jones" wrote:
    >
    > > well since u kno how to embed HTML, just use the the img tag
    > >
    > >
    > > connName.HTMLBody = "<img src=""URL TO IMAGE"" height=""XX"" width=""XX"">
    > >
    > >
    > >
    > > change the connName to ur connection name.
    > > change URL TO IMAGE to the link to ur images u wanna embed.
    > >
    > > change height and width as needed. if ur not gonna mess with these
    > > attributes, then just remove them.
    > >
    > >
    > > note that i have used 2 sets of quoation marks on each side of the value.
    > >
    > > "URL TO IMAGE"
    > >
    > > will throw you an error, and will not send ur message.
    > >
    > >
    > > ""URL TO IMAGE""
    > >
    > >
    > > is the correct format.
    > >
    > >
    > > Hope this helps
    > > Jay
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > > "Manuel" <> wrote in message
    > > news:...
    > > > Is it possible to embed an image, like a company logo in a CDOSYS
    > > > generated
    > > > message?
    > > > If yes, I´ll apreciate some code sample. I´ve been able to formatmessages
    > > > in html the way I like, but I can't figure out how to embed an image.
    > > > Thanks for your time.
    > > >
    > > > --
    > > > Manuel

    > >
    > >
    > >
     
    Mike Brind, Jul 13, 2006
    #7
  8. Manuel

    Manuel Guest

    Thank you Mike.

    I´ll make it one string immediatelly. Thanks for the advice. As for having to
    be on a publicly accessible web server and provide the full url in the src
    attribute, could I not have my server for testing purposes do the job and
    instead of the
    <img src=""http://www.domain.pt/images/image.gif""> have
    <img src=""http://myIP/images/image.gif"">
    To browse the website I´m developing it works. But I´ve tried that and it
    didn't work. If it's not suppose to work, could you explain why? Thanks for
    your pacience and thanks for the pt in the domain.
    That was a kind note.
    --
    Manuel


    "Mike Brind" wrote:

    > You need to host the image on a publicly accessible web server and
    > provide the full url in the src attribute:
    >
    > <img src=""http://www.domain.pt/images/image.gif"">
    >
    > Incidentally, all that string concatentation is terribly wasteful.
    > Each time you write strBody = strBody &, the ASP engine has to recreate
    > the string from scratch, as well as hold the current value of strBody
    > in memory. When I design an html email, I create it in Dreamweaver (or
    > some other WYSIWYG editor) then take the resulting html source, pop it
    > into word and run a tiny macro I created to double up on double quotes
    > and remove paragraphs. That gives me one long unbroken string.
    >
    > Or you can use the underscore character:
    >
    > strBody = "some text" & _
    > "some more text" & _
    > "even more text"
    >
    > --
    > Mike Brind
    >
    > Manuel wrote:
    > > James,
    > > I´m pasting the code that I have now. I hope you bypass the portuguese
    > > language issue.
    > > As you can see, this is a confirmation message of the record insertion in
    > > SQL2000 Server database. I hope this will help you better in your guidance.
    > > Everything works just fine except for the image part as I´ve described in
    > > the previous post.
    > > Thanks again for your pacience.
    > >
    > > <%
    > > Dim Recordset1
    > > Dim Recordset1_numRows
    > >
    > > Set Recordset1 = Server.CreateObject("ADODB.Recordset")
    > > Recordset1.ActiveConnection = MM_Iterartis_Web_STRING
    > > Recordset1.Source = "SELECT ID, Nome, Cidade, Pais, Email, Telefone,
    > > Telemovel, Nome_Contacto, Data_Prevista, Cidade_Origem, Cidade_Destino,
    > > Descricao_Conteudos FROM dbo.contacto_tbl ORDER BY ID DESC"
    > > Recordset1.CursorType = 0
    > > Recordset1.CursorLocation = 2
    > > Recordset1.LockType = 1
    > > Recordset1.Open()
    > >
    > > Recordset1_numRows = 1
    > >
    > > Dim strNome, strCidade, strPais, strEmail, strTelefone, strTelemovel,
    > > strContacto, strDataPrevista, strCidadeOrigem, strCidadeDestino,
    > > strDescricao, strImage
    > > Dim strBody
    > >
    > > strNome = Recordset1("Nome")
    > > strCidade = Recordset1("Cidade")
    > > strPais = Recordset1("Pais")
    > > strEmail = Recordset1("Email")
    > > strTelefone = Recordset1("Telefone")
    > > strTelemovel = Recordset1("Telemovel")
    > > strContacto = Recordset1("Nome_Contacto")
    > > strDataPrevista = Recordset1("Data_Prevista")
    > > strCidadeOrigem = Recordset1("Cidade_Origem")
    > > strCidadeDestino = Recordset1("Cidade_Destino")
    > > strDescricao = Recordset1("Descricao_Conteudos")
    > >
    > > strBody = strBody & "<img src=""/images/Logo.gif""/>" & "<br>" & "<br>"
    > >

    > [snipped]
    >
    > > Dim ObjSendMail
    > > Set ObjSendMail = CreateObject("CDO.Message")
    > >
    > > ObjSendMail.To = strEmail
    > > ObjSendMail.Bcc = ""
    > > ObjSendMail.Subject = "Confirmação de Pedido de Orçamento"
    > > ObjSendMail.From = ""
    > >
    > > ' we are sending a html email.. simply switch the comments around to send a
    > > text email instead
    > > ObjSendMail.HTMLBody = strBody
    > > 'ObjSendMail.TextBody = strBody
    > >
    > > ObjSendMail.Send
    > >
    > > Set ObjSendMail = Nothing
    > >
    > > %>
    > >
    > >
    > > --
    > > Manuel
    > >
    > >
    > > "James Jones" wrote:
    > >
    > > > well since u kno how to embed HTML, just use the the img tag
    > > >
    > > >
    > > > connName.HTMLBody = "<img src=""URL TO IMAGE"" height=""XX"" width=""XX"">
    > > >
    > > >
    > > >
    > > > change the connName to ur connection name.
    > > > change URL TO IMAGE to the link to ur images u wanna embed.
    > > >
    > > > change height and width as needed. if ur not gonna mess with these
    > > > attributes, then just remove them.
    > > >
    > > >
    > > > note that i have used 2 sets of quoation marks on each side of the value.
    > > >
    > > > "URL TO IMAGE"
    > > >
    > > > will throw you an error, and will not send ur message.
    > > >
    > > >
    > > > ""URL TO IMAGE""
    > > >
    > > >
    > > > is the correct format.
    > > >
    > > >
    > > > Hope this helps
    > > > Jay
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > > "Manuel" <> wrote in message
    > > > news:...
    > > > > Is it possible to embed an image, like a company logo in a CDOSYS
    > > > > generated
    > > > > message?
    > > > > If yes, I´ll apreciate some code sample. I´ve been able to format messages
    > > > > in html the way I like, but I can't figure out how to embed an image.
    > > > > Thanks for your time.
    > > > >
    > > > > --
    > > > > Manuel
    > > >
    > > >
    > > >

    >
    >
     
    Manuel, Jul 13, 2006
    #8
  9. Manuel

    Mike Brind Guest

    For testing purposes, of course you can replace the domain with an IP.
    In fact, there's no reason why you can't retain the IP address and keep
    the image there for the real thing. So long as the URL is the correct
    one, I see no reason why it shouldn't work properly, unless your ISP
    has some rules preventing remote hosting of images.

    The pt domain? Thought you'd like that ;-)

    --
    Mike Brind

    Manuel wrote:
    > Thank you Mike.
    >
    > I´ll make it one string immediatelly. Thanks for the advice. As for having to
    > be on a publicly accessible web server and provide the full url in the src
    > attribute, could I not have my server for testing purposes do the job and
    > instead of the
    > <img src=""http://www.domain.pt/images/image.gif""> have
    > <img src=""http://myIP/images/image.gif"">
    > To browse the website I´m developing it works. But I´ve tried that and it
    > didn't work. If it's not suppose to work, could you explain why? Thanks for
    > your pacience and thanks for the pt in the domain.
    > That was a kind note.
    > --
    > Manuel
    >
    >
    > "Mike Brind" wrote:
    >
    > > You need to host the image on a publicly accessible web server and
    > > provide the full url in the src attribute:
    > >
    > > <img src=""http://www.domain.pt/images/image.gif"">
    > >
    > > Incidentally, all that string concatentation is terribly wasteful.
    > > Each time you write strBody = strBody &, the ASP engine has to recreate
    > > the string from scratch, as well as hold the current value of strBody
    > > in memory. When I design an html email, I create it in Dreamweaver (or
    > > some other WYSIWYG editor) then take the resulting html source, pop it
    > > into word and run a tiny macro I created to double up on double quotes
    > > and remove paragraphs. That gives me one long unbroken string.
    > >
    > > Or you can use the underscore character:
    > >
    > > strBody = "some text" & _
    > > "some more text" & _
    > > "even more text"
    > >
    > > --
    > > Mike Brind
    > >
    > > Manuel wrote:
    > > > James,
    > > > I´m pasting the code that I have now. I hope you bypass the portuguese
    > > > language issue.
    > > > As you can see, this is a confirmation message of the record insertion in
    > > > SQL2000 Server database. I hope this will help you better in your guidance.
    > > > Everything works just fine except for the image part as I´ve described in
    > > > the previous post.
    > > > Thanks again for your pacience.
    > > >
    > > > <%
    > > > Dim Recordset1
    > > > Dim Recordset1_numRows
    > > >
    > > > Set Recordset1 = Server.CreateObject("ADODB.Recordset")
    > > > Recordset1.ActiveConnection = MM_Iterartis_Web_STRING
    > > > Recordset1.Source = "SELECT ID, Nome, Cidade, Pais, Email, Telefone,
    > > > Telemovel, Nome_Contacto, Data_Prevista, Cidade_Origem, Cidade_Destino,
    > > > Descricao_Conteudos FROM dbo.contacto_tbl ORDER BY ID DESC"
    > > > Recordset1.CursorType = 0
    > > > Recordset1.CursorLocation = 2
    > > > Recordset1.LockType = 1
    > > > Recordset1.Open()
    > > >
    > > > Recordset1_numRows = 1
    > > >
    > > > Dim strNome, strCidade, strPais, strEmail, strTelefone, strTelemovel,
    > > > strContacto, strDataPrevista, strCidadeOrigem, strCidadeDestino,
    > > > strDescricao, strImage
    > > > Dim strBody
    > > >
    > > > strNome = Recordset1("Nome")
    > > > strCidade = Recordset1("Cidade")
    > > > strPais = Recordset1("Pais")
    > > > strEmail = Recordset1("Email")
    > > > strTelefone = Recordset1("Telefone")
    > > > strTelemovel = Recordset1("Telemovel")
    > > > strContacto = Recordset1("Nome_Contacto")
    > > > strDataPrevista = Recordset1("Data_Prevista")
    > > > strCidadeOrigem = Recordset1("Cidade_Origem")
    > > > strCidadeDestino = Recordset1("Cidade_Destino")
    > > > strDescricao = Recordset1("Descricao_Conteudos")
    > > >
    > > > strBody = strBody & "<img src=""/images/Logo.gif""/>" & "<br>" & "<br>"
    > > >

    > > [snipped]
    > >
    > > > Dim ObjSendMail
    > > > Set ObjSendMail = CreateObject("CDO.Message")
    > > >
    > > > ObjSendMail.To = strEmail
    > > > ObjSendMail.Bcc = ""
    > > > ObjSendMail.Subject = "Confirmação de Pedido de Orçamento"
    > > > ObjSendMail.From = ""
    > > >
    > > > ' we are sending a html email.. simply switch the comments around to send a
    > > > text email instead
    > > > ObjSendMail.HTMLBody = strBody
    > > > 'ObjSendMail.TextBody = strBody
    > > >
    > > > ObjSendMail.Send
    > > >
    > > > Set ObjSendMail = Nothing
    > > >
    > > > %>
    > > >
    > > >
    > > > --
    > > > Manuel
    > > >
    > > >
    > > > "James Jones" wrote:
    > > >
    > > > > well since u kno how to embed HTML, just use the the img tag
    > > > >
    > > > >
    > > > > connName.HTMLBody = "<img src=""URL TO IMAGE"" height=""XX"" width=""XX"">
    > > > >
    > > > >
    > > > >
    > > > > change the connName to ur connection name.
    > > > > change URL TO IMAGE to the link to ur images u wanna embed.
    > > > >
    > > > > change height and width as needed. if ur not gonna mess with these
    > > > > attributes, then just remove them.
    > > > >
    > > > >
    > > > > note that i have used 2 sets of quoation marks on each side of the value.
    > > > >
    > > > > "URL TO IMAGE"
    > > > >
    > > > > will throw you an error, and will not send ur message.
    > > > >
    > > > >
    > > > > ""URL TO IMAGE""
    > > > >
    > > > >
    > > > > is the correct format.
    > > > >
    > > > >
    > > > > Hope this helps
    > > > > Jay
    > > > >
    > > > >
    > > > >
    > > > >
    > > > >
    > > > >
    > > > >
    > > > > "Manuel" <> wrote in message
    > > > > news:...
    > > > > > Is it possible to embed an image, like a company logo in a CDOSYS
    > > > > > generated
    > > > > > message?
    > > > > > If yes, I´ll apreciate some code sample. I´ve been able to format messages
    > > > > > in html the way I like, but I can't figure out how to embed an image.
    > > > > > Thanks for your time.
    > > > > >
    > > > > > --
    > > > > > Manuel
    > > > >
    > > > >
    > > > >

    > >
    > >
     
    Mike Brind, Jul 13, 2006
    #9
  10. Manuel

    Manuel Guest

    Correction Mike:

    It works beautifully. I had a wrong statement. Everything is already in one
    string. Thanks once more for the lesson.
    --
    Manuel


    "Mike Brind" wrote:

    > You need to host the image on a publicly accessible web server and
    > provide the full url in the src attribute:
    >
    > <img src=""http://www.domain.pt/images/image.gif"">
    >
    > Incidentally, all that string concatentation is terribly wasteful.
    > Each time you write strBody = strBody &, the ASP engine has to recreate
    > the string from scratch, as well as hold the current value of strBody
    > in memory. When I design an html email, I create it in Dreamweaver (or
    > some other WYSIWYG editor) then take the resulting html source, pop it
    > into word and run a tiny macro I created to double up on double quotes
    > and remove paragraphs. That gives me one long unbroken string.
    >
    > Or you can use the underscore character:
    >
    > strBody = "some text" & _
    > "some more text" & _
    > "even more text"
    >
    > --
    > Mike Brind
    >
    > Manuel wrote:
    > > James,
    > > I´m pasting the code that I have now. I hope you bypass the portuguese
    > > language issue.
    > > As you can see, this is a confirmation message of the record insertion in
    > > SQL2000 Server database. I hope this will help you better in your guidance.
    > > Everything works just fine except for the image part as I´ve described in
    > > the previous post.
    > > Thanks again for your pacience.
    > >
    > > <%
    > > Dim Recordset1
    > > Dim Recordset1_numRows
    > >
    > > Set Recordset1 = Server.CreateObject("ADODB.Recordset")
    > > Recordset1.ActiveConnection = MM_Iterartis_Web_STRING
    > > Recordset1.Source = "SELECT ID, Nome, Cidade, Pais, Email, Telefone,
    > > Telemovel, Nome_Contacto, Data_Prevista, Cidade_Origem, Cidade_Destino,
    > > Descricao_Conteudos FROM dbo.contacto_tbl ORDER BY ID DESC"
    > > Recordset1.CursorType = 0
    > > Recordset1.CursorLocation = 2
    > > Recordset1.LockType = 1
    > > Recordset1.Open()
    > >
    > > Recordset1_numRows = 1
    > >
    > > Dim strNome, strCidade, strPais, strEmail, strTelefone, strTelemovel,
    > > strContacto, strDataPrevista, strCidadeOrigem, strCidadeDestino,
    > > strDescricao, strImage
    > > Dim strBody
    > >
    > > strNome = Recordset1("Nome")
    > > strCidade = Recordset1("Cidade")
    > > strPais = Recordset1("Pais")
    > > strEmail = Recordset1("Email")
    > > strTelefone = Recordset1("Telefone")
    > > strTelemovel = Recordset1("Telemovel")
    > > strContacto = Recordset1("Nome_Contacto")
    > > strDataPrevista = Recordset1("Data_Prevista")
    > > strCidadeOrigem = Recordset1("Cidade_Origem")
    > > strCidadeDestino = Recordset1("Cidade_Destino")
    > > strDescricao = Recordset1("Descricao_Conteudos")
    > >
    > > strBody = strBody & "<img src=""/images/Logo.gif""/>" & "<br>" & "<br>"
    > >

    > [snipped]
    >
    > > Dim ObjSendMail
    > > Set ObjSendMail = CreateObject("CDO.Message")
    > >
    > > ObjSendMail.To = strEmail
    > > ObjSendMail.Bcc = ""
    > > ObjSendMail.Subject = "Confirmação de Pedido de Orçamento"
    > > ObjSendMail.From = ""
    > >
    > > ' we are sending a html email.. simply switch the comments around to send a
    > > text email instead
    > > ObjSendMail.HTMLBody = strBody
    > > 'ObjSendMail.TextBody = strBody
    > >
    > > ObjSendMail.Send
    > >
    > > Set ObjSendMail = Nothing
    > >
    > > %>
    > >
    > >
    > > --
    > > Manuel
    > >
    > >
    > > "James Jones" wrote:
    > >
    > > > well since u kno how to embed HTML, just use the the img tag
    > > >
    > > >
    > > > connName.HTMLBody = "<img src=""URL TO IMAGE"" height=""XX"" width=""XX"">
    > > >
    > > >
    > > >
    > > > change the connName to ur connection name.
    > > > change URL TO IMAGE to the link to ur images u wanna embed.
    > > >
    > > > change height and width as needed. if ur not gonna mess with these
    > > > attributes, then just remove them.
    > > >
    > > >
    > > > note that i have used 2 sets of quoation marks on each side of the value.
    > > >
    > > > "URL TO IMAGE"
    > > >
    > > > will throw you an error, and will not send ur message.
    > > >
    > > >
    > > > ""URL TO IMAGE""
    > > >
    > > >
    > > > is the correct format.
    > > >
    > > >
    > > > Hope this helps
    > > > Jay
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > > "Manuel" <> wrote in message
    > > > news:...
    > > > > Is it possible to embed an image, like a company logo in a CDOSYS
    > > > > generated
    > > > > message?
    > > > > If yes, I´ll apreciate some code sample. I´ve been able to format messages
    > > > > in html the way I like, but I can't figure out how to embed an image.
    > > > > Thanks for your time.
    > > > >
    > > > > --
    > > > > Manuel
    > > >
    > > >
    > > >

    >
    >
     
    Manuel, Jul 13, 2006
    #10
  11. Manuel

    Manuel Guest

    I loved it ;-)

    Amazing. Half way around the world and you still can find caring people.
    To another occasion I´m sure.

    Thanks again
    --
    Manuel


    "Mike Brind" wrote:

    > For testing purposes, of course you can replace the domain with an IP.
    > In fact, there's no reason why you can't retain the IP address and keep
    > the image there for the real thing. So long as the URL is the correct
    > one, I see no reason why it shouldn't work properly, unless your ISP
    > has some rules preventing remote hosting of images.
    >
    > The pt domain? Thought you'd like that ;-)
    >
    > --
    > Mike Brind
    >
    > Manuel wrote:
    > > Thank you Mike.
    > >
    > > I´ll make it one string immediatelly. Thanks for the advice. As for having to
    > > be on a publicly accessible web server and provide the full url in the src
    > > attribute, could I not have my server for testing purposes do the job and
    > > instead of the
    > > <img src=""http://www.domain.pt/images/image.gif""> have
    > > <img src=""http://myIP/images/image.gif"">
    > > To browse the website I´m developing it works. But I´ve tried that and it
    > > didn't work. If it's not suppose to work, could you explain why? Thanks for
    > > your pacience and thanks for the pt in the domain.
    > > That was a kind note.
    > > --
    > > Manuel
    > >
    > >
    > > "Mike Brind" wrote:
    > >
    > > > You need to host the image on a publicly accessible web server and
    > > > provide the full url in the src attribute:
    > > >
    > > > <img src=""http://www.domain.pt/images/image.gif"">
    > > >
    > > > Incidentally, all that string concatentation is terribly wasteful.
    > > > Each time you write strBody = strBody &, the ASP engine has to recreate
    > > > the string from scratch, as well as hold the current value of strBody
    > > > in memory. When I design an html email, I create it in Dreamweaver (or
    > > > some other WYSIWYG editor) then take the resulting html source, pop it
    > > > into word and run a tiny macro I created to double up on double quotes
    > > > and remove paragraphs. That gives me one long unbroken string.
    > > >
    > > > Or you can use the underscore character:
    > > >
    > > > strBody = "some text" & _
    > > > "some more text" & _
    > > > "even more text"
    > > >
    > > > --
    > > > Mike Brind
    > > >
    > > > Manuel wrote:
    > > > > James,
    > > > > I´m pasting the code that I have now. I hope you bypass the portuguese
    > > > > language issue.
    > > > > As you can see, this is a confirmation message of the record insertion in
    > > > > SQL2000 Server database. I hope this will help you better in your guidance.
    > > > > Everything works just fine except for the image part as I´ve described in
    > > > > the previous post.
    > > > > Thanks again for your pacience.
    > > > >
    > > > > <%
    > > > > Dim Recordset1
    > > > > Dim Recordset1_numRows
    > > > >
    > > > > Set Recordset1 = Server.CreateObject("ADODB.Recordset")
    > > > > Recordset1.ActiveConnection = MM_Iterartis_Web_STRING
    > > > > Recordset1.Source = "SELECT ID, Nome, Cidade, Pais, Email, Telefone,
    > > > > Telemovel, Nome_Contacto, Data_Prevista, Cidade_Origem, Cidade_Destino,
    > > > > Descricao_Conteudos FROM dbo.contacto_tbl ORDER BY ID DESC"
    > > > > Recordset1.CursorType = 0
    > > > > Recordset1.CursorLocation = 2
    > > > > Recordset1.LockType = 1
    > > > > Recordset1.Open()
    > > > >
    > > > > Recordset1_numRows = 1
    > > > >
    > > > > Dim strNome, strCidade, strPais, strEmail, strTelefone, strTelemovel,
    > > > > strContacto, strDataPrevista, strCidadeOrigem, strCidadeDestino,
    > > > > strDescricao, strImage
    > > > > Dim strBody
    > > > >
    > > > > strNome = Recordset1("Nome")
    > > > > strCidade = Recordset1("Cidade")
    > > > > strPais = Recordset1("Pais")
    > > > > strEmail = Recordset1("Email")
    > > > > strTelefone = Recordset1("Telefone")
    > > > > strTelemovel = Recordset1("Telemovel")
    > > > > strContacto = Recordset1("Nome_Contacto")
    > > > > strDataPrevista = Recordset1("Data_Prevista")
    > > > > strCidadeOrigem = Recordset1("Cidade_Origem")
    > > > > strCidadeDestino = Recordset1("Cidade_Destino")
    > > > > strDescricao = Recordset1("Descricao_Conteudos")
    > > > >
    > > > > strBody = strBody & "<img src=""/images/Logo.gif""/>" & "<br>" & "<br>"
    > > > >
    > > > [snipped]
    > > >
    > > > > Dim ObjSendMail
    > > > > Set ObjSendMail = CreateObject("CDO.Message")
    > > > >
    > > > > ObjSendMail.To = strEmail
    > > > > ObjSendMail.Bcc = ""
    > > > > ObjSendMail.Subject = "Confirmação de Pedido de Orçamento"
    > > > > ObjSendMail.From = ""
    > > > >
    > > > > ' we are sending a html email.. simply switch the comments around to send a
    > > > > text email instead
    > > > > ObjSendMail.HTMLBody = strBody
    > > > > 'ObjSendMail.TextBody = strBody
    > > > >
    > > > > ObjSendMail.Send
    > > > >
    > > > > Set ObjSendMail = Nothing
    > > > >
    > > > > %>
    > > > >
    > > > >
    > > > > --
    > > > > Manuel
    > > > >
    > > > >
    > > > > "James Jones" wrote:
    > > > >
    > > > > > well since u kno how to embed HTML, just use the the img tag
    > > > > >
    > > > > >
    > > > > > connName.HTMLBody = "<img src=""URL TO IMAGE"" height=""XX"" width=""XX"">
    > > > > >
    > > > > >
    > > > > >
    > > > > > change the connName to ur connection name.
    > > > > > change URL TO IMAGE to the link to ur images u wanna embed.
    > > > > >
    > > > > > change height and width as needed. if ur not gonna mess with these
    > > > > > attributes, then just remove them.
    > > > > >
    > > > > >
    > > > > > note that i have used 2 sets of quoation marks on each side of the value.
    > > > > >
    > > > > > "URL TO IMAGE"
    > > > > >
    > > > > > will throw you an error, and will not send ur message.
    > > > > >
    > > > > >
    > > > > > ""URL TO IMAGE""
    > > > > >
    > > > > >
    > > > > > is the correct format.
    > > > > >
    > > > > >
    > > > > > Hope this helps
    > > > > > Jay
    > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > > > > "Manuel" <> wrote in message
    > > > > > news:...
    > > > > > > Is it possible to embed an image, like a company logo in a CDOSYS
    > > > > > > generated
    > > > > > > message?
    > > > > > > If yes, I´ll apreciate some code sample. I´ve been able to format messages
    > > > > > > in html the way I like, but I can't figure out how to embed an image.
    > > > > > > Thanks for your time.
    > > > > > >
    > > > > > > --
    > > > > > > Manuel
    > > > > >
    > > > > >
    > > > > >
    > > >
    > > >

    >
    >
     
    Manuel, Jul 13, 2006
    #11
  12. "Manuel" <> wrote in message
    news:...
    > Thanks for the help.
    > What I´ve done was to send an email to myself in html format with the logo
    > that I need in it.
    > Then I´ve looked at the html code and copy the src as it was to the CDOSYS
    > message.
    >
    > <img width=192 height=36
    > id="_x0000_i1025" src="cid:3E5D670">
    >
    > When I´ve send it, it complain of an end of statement expected just after
    > the 36.


    You're at it, nearly, but you'll have to rename the images, and embed them
    as base64 attachments.
    CDOSYS cannot do it all alone.
    I've included a sample, but I've cut short the base64 stuff, because it
    won't be allowed by MS to attache huge files.

    So, you would need to create more bodyparts (see CDOSYS docs) and some body
    parts are
    Content-Type: text/html;
    charset="utf-8"
    Content-Transfer-Encoding: quoted-printable

    And the others are

    Content-Type: image/jpeg
    Content-Transfer-Encoding: base64

    I have tiny a C++ COM utility (40KB) that very easily can do it for you,
    encoding a single file into base64.
    This can be called by scripting as well.

    > So I´ve remove the with and height, put double quotes where single ones
    > were, and send. No errors. But now the message arrives and not even the
    > image
    > placeholder is there.
    >
    > Then I´ve put the correct url of the image like this:
    >
    > <img src:""cid:/images/logo50.gif""> and send it. Again no errors but
    > again
    > no placeholder.
    >
    > I don´t know if I´ve followed correctly your instruction, but I´m still
    > stuck.


    Another trick would be to have the images with an absolute URL to your
    webserver. However, spam filters, will see that sort of mail as spyware.

    > Thanks
    >
    > --
    > Manuel
    >
    >
    > "Egbert Nierop (MVP for IIS)" wrote:
    >
    >>
    >> "Manuel" <> wrote in message
    >> news:...
    >> > Is it possible to embed an image, like a company logo in a CDOSYS
    >> > generated
    >> > message?
    >> > If yes, I´ll apreciate some code sample. I´ve been able to format
    >> > messages
    >> > in html the way I like, but I can't figure out how to embed an image.
    >> > Thanks for your time.

    >>
    >> What you'd do best, is generate an email thorugh outlook or other
    >> program,
    >> where the emails are embedded.
    >> Sample. Use IE6 to save a website to a single page!
    >> Then look at the contents of the page, it will be MIME 1.0 part encoded.
    >>
    >> The MSDN has some samples.
    >>
    >>
     
    Egbert Nierop \(MVP for IIS\), Jul 14, 2006
    #12
  13. Manuel

    Manuel Guest

    Thanks Egbert for your reply.
    I got an encoded utility.
    Now, my question is about adding the body parts that you mention.
    First I´ve initiated the string of the mail body with
    strBody ="<img src=""cid=/images/logocdosys.jpeg"">" & "<br>" & "<br>" & _
    Then I have

    Dim ObjSendMail
    Set ObjSendMail = CreateObject("CDO.Message")
    Content-Type: text/html;
    charset="utf-8"
    Content-Transfer-Encoding: quoted-printable


    Content-Type: image/jpeg
    Content-Transfer-Encoding: base64

    ObjSendMail.To = strEmail
    ObjSendMail.Bcc = "myEmail"
    ObjSendMail.Subject = "Confirmação de Pedido de Orçamento"
    ObjSendMail.From = "myEmail"

    ObjSendMail.HTMLBody = strBody

    ObjSendMail.Send

    Set ObjSendMail = Nothing

    This comes up with the error:
    Microsoft VBScript compilation error '800a03ea'

    Syntax error

    /email.asp, line 61

    Content-Type: text/html;
    --------^
    What am I still missing?

    Thanks for your time, but although I have it running using the full URL
    path, I´d like to learn this method.


    --
    Manuel


    "Egbert Nierop (MVP for IIS)" wrote:

    >
    > "Manuel" <> wrote in message
    > news:...
    > > Thanks for the help.
    > > What I´ve done was to send an email to myself in html format with the logo
    > > that I need in it.
    > > Then I´ve looked at the html code and copy the src as it was to the CDOSYS
    > > message.
    > >
    > > <img width=192 height=36
    > > id="_x0000_i1025" src="cid:3E5D670">
    > >
    > > When I´ve send it, it complain of an end of statement expected just after
    > > the 36.

    >
    > You're at it, nearly, but you'll have to rename the images, and embed them
    > as base64 attachments.
    > CDOSYS cannot do it all alone.
    > I've included a sample, but I've cut short the base64 stuff, because it
    > won't be allowed by MS to attache huge files.
    >
    > So, you would need to create more bodyparts (see CDOSYS docs) and some body
    > parts are
    > Content-Type: text/html;
    > charset="utf-8"
    > Content-Transfer-Encoding: quoted-printable
    >
    > And the others are
    >
    > Content-Type: image/jpeg
    > Content-Transfer-Encoding: base64
    >
    > I have tiny a C++ COM utility (40KB) that very easily can do it for you,
    > encoding a single file into base64.
    > This can be called by scripting as well.
    >
    > > So I´ve remove the with and height, put double quotes where single ones
    > > were, and send. No errors. But now the message arrives and not even the
    > > image
    > > placeholder is there.
    > >
    > > Then I´ve put the correct url of the image like this:
    > >
    > > <img src:""cid:/images/logo50.gif""> and send it. Again no errors but
    > > again
    > > no placeholder.
    > >
    > > I don´t know if I´ve followed correctly your instruction, but I´m still
    > > stuck.

    >
    > Another trick would be to have the images with an absolute URL to your
    > webserver. However, spam filters, will see that sort of mail as spyware.
    >
    > > Thanks
    > >
    > > --
    > > Manuel
    > >
    > >
    > > "Egbert Nierop (MVP for IIS)" wrote:
    > >
    > >>
    > >> "Manuel" <> wrote in message
    > >> news:...
    > >> > Is it possible to embed an image, like a company logo in a CDOSYS
    > >> > generated
    > >> > message?
    > >> > If yes, I´ll apreciate some code sample. I´ve been able to format
    > >> > messages
    > >> > in html the way I like, but I can't figure out how to embed an image.
    > >> > Thanks for your time.
    > >>
    > >> What you'd do best, is generate an email thorugh outlook or other
    > >> program,
    > >> where the emails are embedded.
    > >> Sample. Use IE6 to save a website to a single page!
    > >> Then look at the contents of the page, it will be MIME 1.0 part encoded.
    > >>
    > >> The MSDN has some samples.
    > >>
    > >>

    >
     
    Manuel, Jul 14, 2006
    #13
  14. "Manuel" <> wrote in message
    news:...
    > Thanks Egbert for your reply.
    > I got an encoded utility.
    > Now, my question is about adding the body parts that you mention.
    > First I´ve initiated the string of the mail body with
    > strBody ="<img src=""cid=/images/logocdosys.jpeg"">" & "<br>" & "<br>" & _
    > Then I have
    >
    > Dim ObjSendMail
    > Set ObjSendMail = CreateObject("CDO.Message")
    > Content-Type: text/html;
    > charset="utf-8"
    > Content-Transfer-Encoding: quoted-printable
    >
    >
    > Content-Type: image/jpeg
    > Content-Transfer-Encoding: base64
    >
    > ObjSendMail.To = strEmail
    > ObjSendMail.Bcc = "myEmail"
    > ObjSendMail.Subject = "Confirmação de Pedido de Orçamento"
    > ObjSendMail.From = "myEmail"
    >
    > ObjSendMail.HTMLBody = strBody


    These methods, HTMLBody etc, are shortcuts but in fact, CDOSYS in not really
    easy to use :)
    http://msdn.microsoft.com/library/d...html/2dea7d01-cc18-4c66-8bf6-9d21a0f0547a.asp

    So if you use the method above, from a 'standard HTML page' (can also be
    locally) it will convert this for you!

    > ObjSendMail.Send
    >
    > Set ObjSendMail = Nothing
    >
    > This comes up with the error:
    > Microsoft VBScript compilation error '800a03ea'
    >
    > Syntax error
    >
    > /email.asp, line 61
    >
    > Content-Type: text/html;
    > --------^
    > What am I still missing?
    >
    > Thanks for your time, but although I have it running using the full URL
    > path, I´d like to learn this method.
    >
    >
    > --
    > Manuel
    >
    >
    > "Egbert Nierop (MVP for IIS)" wrote:
    >
    >>
    >> "Manuel" <> wrote in message
    >> news:...
    >> > Thanks for the help.
    >> > What I´ve done was to send an email to myself in html format with the
    >> > logo
    >> > that I need in it.
    >> > Then I´ve looked at the html code and copy the src as it was to the
    >> > CDOSYS
    >> > message.
    >> >
    >> > <img width=192 height=36
    >> > id="_x0000_i1025" src="cid:3E5D670">
    >> >
    >> > When I´ve send it, it complain of an end of statement expected just
    >> > after
    >> > the 36.

    >>
    >> You're at it, nearly, but you'll have to rename the images, and embed
    >> them
    >> as base64 attachments.
    >> CDOSYS cannot do it all alone.
    >> I've included a sample, but I've cut short the base64 stuff, because it
    >> won't be allowed by MS to attache huge files.
    >>
    >> So, you would need to create more bodyparts (see CDOSYS docs) and some
    >> body
    >> parts are
    >> Content-Type: text/html;
    >> charset="utf-8"
    >> Content-Transfer-Encoding: quoted-printable
    >>
    >> And the others are
    >>
    >> Content-Type: image/jpeg
    >> Content-Transfer-Encoding: base64
    >>
    >> I have tiny a C++ COM utility (40KB) that very easily can do it for you,
    >> encoding a single file into base64.
    >> This can be called by scripting as well.
    >>
    >> > So I´ve remove the with and height, put double quotes where single ones
    >> > were, and send. No errors. But now the message arrives and not even the
    >> > image
    >> > placeholder is there.
    >> >
    >> > Then I´ve put the correct url of the image like this:
    >> >
    >> > <img src:""cid:/images/logo50.gif""> and send it. Again no errors but
    >> > again
    >> > no placeholder.
    >> >
    >> > I don´t know if I´ve followed correctly your instruction, but I´m still
    >> > stuck.

    >>
    >> Another trick would be to have the images with an absolute URL to your
    >> webserver. However, spam filters, will see that sort of mail as spyware.
    >>
    >> > Thanks
    >> >
    >> > --
    >> > Manuel
    >> >
    >> >
    >> > "Egbert Nierop (MVP for IIS)" wrote:
    >> >
    >> >>
    >> >> "Manuel" <> wrote in message
    >> >> news:...
    >> >> > Is it possible to embed an image, like a company logo in a CDOSYS
    >> >> > generated
    >> >> > message?
    >> >> > If yes, I´ll apreciate some code sample. I´ve been able to format
    >> >> > messages
    >> >> > in html the way I like, but I can't figure out how to embed an
    >> >> > image.
    >> >> > Thanks for your time.
    >> >>
    >> >> What you'd do best, is generate an email thorugh outlook or other
    >> >> program,
    >> >> where the emails are embedded.
    >> >> Sample. Use IE6 to save a website to a single page!
    >> >> Then look at the contents of the page, it will be MIME 1.0 part
    >> >> encoded.
    >> >>
    >> >> The MSDN has some samples.
    >> >>
    >> >>

    >>
     
    Egbert Nierop \(MVP for IIS\), Jul 14, 2006
    #14
  15. Manuel

    Manuel Guest

    Thanks Egbert,

    I´ll be studying the references that you mention.

    --
    Manuel


    "Egbert Nierop (MVP for IIS)" wrote:

    >
    > "Manuel" <> wrote in message
    > news:...
    > > Thanks Egbert for your reply.
    > > I got an encoded utility.
    > > Now, my question is about adding the body parts that you mention.
    > > First I´ve initiated the string of the mail body with
    > > strBody ="<img src=""cid=/images/logocdosys.jpeg"">" & "<br>" & "<br>" & _
    > > Then I have
    > >
    > > Dim ObjSendMail
    > > Set ObjSendMail = CreateObject("CDO.Message")
    > > Content-Type: text/html;
    > > charset="utf-8"
    > > Content-Transfer-Encoding: quoted-printable
    > >
    > >
    > > Content-Type: image/jpeg
    > > Content-Transfer-Encoding: base64
    > >
    > > ObjSendMail.To = strEmail
    > > ObjSendMail.Bcc = "myEmail"
    > > ObjSendMail.Subject = "Confirmação de Pedido de Orçamento"
    > > ObjSendMail.From = "myEmail"
    > >
    > > ObjSendMail.HTMLBody = strBody

    >
    > These methods, HTMLBody etc, are shortcuts but in fact, CDOSYS in not really
    > easy to use :)
    > http://msdn.microsoft.com/library/d...html/2dea7d01-cc18-4c66-8bf6-9d21a0f0547a.asp
    >
    > So if you use the method above, from a 'standard HTML page' (can also be
    > locally) it will convert this for you!
    >
    > > ObjSendMail.Send
    > >
    > > Set ObjSendMail = Nothing
    > >
    > > This comes up with the error:
    > > Microsoft VBScript compilation error '800a03ea'
    > >
    > > Syntax error
    > >
    > > /email.asp, line 61
    > >
    > > Content-Type: text/html;
    > > --------^
    > > What am I still missing?
    > >
    > > Thanks for your time, but although I have it running using the full URL
    > > path, I´d like to learn this method.
    > >
    > >
    > > --
    > > Manuel
    > >
    > >
    > > "Egbert Nierop (MVP for IIS)" wrote:
    > >
    > >>
    > >> "Manuel" <> wrote in message
    > >> news:...
    > >> > Thanks for the help.
    > >> > What I´ve done was to send an email to myself in html format with the
    > >> > logo
    > >> > that I need in it.
    > >> > Then I´ve looked at the html code and copy the src as it was to the
    > >> > CDOSYS
    > >> > message.
    > >> >
    > >> > <img width=192 height=36
    > >> > id="_x0000_i1025" src="cid:3E5D670">
    > >> >
    > >> > When I´ve send it, it complain of an end of statement expected just
    > >> > after
    > >> > the 36.
    > >>
    > >> You're at it, nearly, but you'll have to rename the images, and embed
    > >> them
    > >> as base64 attachments.
    > >> CDOSYS cannot do it all alone.
    > >> I've included a sample, but I've cut short the base64 stuff, because it
    > >> won't be allowed by MS to attache huge files.
    > >>
    > >> So, you would need to create more bodyparts (see CDOSYS docs) and some
    > >> body
    > >> parts are
    > >> Content-Type: text/html;
    > >> charset="utf-8"
    > >> Content-Transfer-Encoding: quoted-printable
    > >>
    > >> And the others are
    > >>
    > >> Content-Type: image/jpeg
    > >> Content-Transfer-Encoding: base64
    > >>
    > >> I have tiny a C++ COM utility (40KB) that very easily can do it for you,
    > >> encoding a single file into base64.
    > >> This can be called by scripting as well.
    > >>
    > >> > So I´ve remove the with and height, put double quotes where single ones
    > >> > were, and send. No errors. But now the message arrives and not even the
    > >> > image
    > >> > placeholder is there.
    > >> >
    > >> > Then I´ve put the correct url of the image like this:
    > >> >
    > >> > <img src:""cid:/images/logo50.gif""> and send it. Again no errors but
    > >> > again
    > >> > no placeholder.
    > >> >
    > >> > I don´t know if I´ve followed correctly your instruction, but I´m still
    > >> > stuck.
    > >>
    > >> Another trick would be to have the images with an absolute URL to your
    > >> webserver. However, spam filters, will see that sort of mail as spyware.
    > >>
    > >> > Thanks
    > >> >
    > >> > --
    > >> > Manuel
    > >> >
    > >> >
    > >> > "Egbert Nierop (MVP for IIS)" wrote:
    > >> >
    > >> >>
    > >> >> "Manuel" <> wrote in message
    > >> >> news:...
    > >> >> > Is it possible to embed an image, like a company logo in a CDOSYS
    > >> >> > generated
    > >> >> > message?
    > >> >> > If yes, I´ll apreciate some code sample. I´ve been able to format
    > >> >> > messages
    > >> >> > in html the way I like, but I can't figure out how to embed an
    > >> >> > image.
    > >> >> > Thanks for your time.
    > >> >>
    > >> >> What you'd do best, is generate an email thorugh outlook or other
    > >> >> program,
    > >> >> where the emails are embedded.
    > >> >> Sample. Use IE6 to save a website to a single page!
    > >> >> Then look at the contents of the page, it will be MIME 1.0 part
    > >> >> encoded.
    > >> >>
    > >> >> The MSDN has some samples.
    > >> >>
    > >> >>
    > >>

    >
    >
     
    Manuel, Jul 14, 2006
    #15
  16. "Manuel" <> wrote in message
    news:...
    > Is it possible to embed an image, like a company logo in a CDOSYS

    generated
    > message?
    > If yes, I´ll apreciate some code sample. I´ve been able to format messages
    > in html the way I like, but I can't figure out how to embed an image.
    > Thanks for your time.
    >
    > --
    > Manuel


    Yet another option is to use the CreateMHTMLBody method of the CDOSYS
    Message object.

    You create an ASP page that generates the html content that you want the
    receipents to see.

    You then simply supply the URL of this ASP page to the CreateMHTMLBody
    method. It will build a html body along appropriate references to body
    parts that it will create for you as well.

    Eg.

    MyHTMLContent.asp

    <html>
    <body>
    <b>Hello World</b><.br />
    <img src="photo.gif" />
    </body>
    </html>

    MyEmail generator:-

    Dim oMsg : Set oMsg = Server.CreateObject("CDO.Message")

    oMsg.From = ...
    oMsg.To = ...
    ..
    ..
    ..
    oMsg.CreateMHTMLBody = "http://" & Request.ServerVariables("SERVER_NAME") &
    "/somefolder/MyHTMLContent.asp"

    oMsg.Send

    HTH,

    Anthony.
     
    Anthony Jones, Jul 14, 2006
    #16
  17. Manuel

    Manuel Guest

    Thanks Anthony,

    That´s actually a great piece of information. No doupt I'll be trying it.
    Learned one more today ;-)
    --
    Manuel


    "Anthony Jones" wrote:

    >
    > "Manuel" <> wrote in message
    > news:...
    > > Is it possible to embed an image, like a company logo in a CDOSYS

    > generated
    > > message?
    > > If yes, I´ll apreciate some code sample. I´ve been able to format messages
    > > in html the way I like, but I can't figure out how to embed an image.
    > > Thanks for your time.
    > >
    > > --
    > > Manuel

    >
    > Yet another option is to use the CreateMHTMLBody method of the CDOSYS
    > Message object.
    >
    > You create an ASP page that generates the html content that you want the
    > receipents to see.
    >
    > You then simply supply the URL of this ASP page to the CreateMHTMLBody
    > method. It will build a html body along appropriate references to body
    > parts that it will create for you as well.
    >
    > Eg.
    >
    > MyHTMLContent.asp
    >
    > <html>
    > <body>
    > <b>Hello World</b><.br />
    > <img src="photo.gif" />
    > </body>
    > </html>
    >
    > MyEmail generator:-
    >
    > Dim oMsg : Set oMsg = Server.CreateObject("CDO.Message")
    >
    > oMsg.From = ...
    > oMsg.To = ...
    > ..
    > ..
    > ..
    > oMsg.CreateMHTMLBody = "http://" & Request.ServerVariables("SERVER_NAME") &
    > "/somefolder/MyHTMLContent.asp"
    >
    > oMsg.Send
    >
    > HTH,
    >
    > Anthony.
    >
    >
    >
     
    Manuel, Jul 14, 2006
    #17
  18. Egbert Nierop \(MVP for IIS\), Jul 14, 2006
    #18
  19. Manuel

    Manuel Guest

    Thanks Egbert,

    Already had a look and it makes sense to me. Actually I was confused on the
    previous link ;-)
    --
    Manuel


    "Egbert Nierop (MVP for IIS)" wrote:

    >
    > "Manuel" <> wrote in message
    > news:...
    > > Thanks Egbert,
    > >
    > > I´ll be studying the references that you mention.

    >
    > For some reason I posted the wrong reference.
    >
    > This one is which you need.
    >
    > http://msdn.microsoft.com/library/e...ed-d986-47fa-874f-2b36a9d50e03.asp?frame=true
    >
    >
     
    Manuel, Jul 14, 2006
    #19
  20. Manuel

    Manuel Guest

    Egbert,

    I would like to thank you, as this reference did it. It's running and base64
    encoded :)
    To next time.

    --
    Manuel


    "Egbert Nierop (MVP for IIS)" wrote:

    >
    > "Manuel" <> wrote in message
    > news:...
    > > Thanks Egbert,
    > >
    > > I´ll be studying the references that you mention.

    >
    > For some reason I posted the wrong reference.
    >
    > This one is which you need.
    >
    > http://msdn.microsoft.com/library/e...ed-d986-47fa-874f-2b36a9d50e03.asp?frame=true
    >
    >
     
    Manuel, Jul 15, 2006
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. René de Leeuw

    embed pictures in a cdosys sent message

    René de Leeuw, Jul 22, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    418
    René de Leeuw
    Jul 22, 2003
  2. martin

    cdosys.dll and sending mail

    martin, Jul 15, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    4,127
    wolfgangiron
    Jan 4, 2012
  3. Mike Duffy
    Replies:
    4
    Views:
    467
  4. Peter Croft

    Setting message priority with CDOSYS

    Peter Croft, Jul 18, 2004, in forum: ASP General
    Replies:
    6
    Views:
    212
    Yan-Hong Huang[MSFT]
    Jul 22, 2004
  5. Angus
    Replies:
    1
    Views:
    106
    Mike Duffy
    Mar 31, 2009
Loading...

Share This Page