Results 1 to 7 of 7

Thread: html email problem

  1. #1

    Thread Starter
    Fanatic Member davebat's Avatar
    Join Date
    Dec 2002
    Posts
    727

    html email problem

    im sending a html email through my miler object.

    when i dont include an attachment it works fine, but when i do the message arrives as plain text.

    here is the code on the page.

    V_HTML = "<html>"
    V_HTML = V_HTML+ "<head>"
    V_HTML = V_HTML+ "</head>"
    V_HTML = V_HTML+ "<body bgcolor='#ffffff'>"
    V_HTML = V_HTML+ "<font color='red'>"
    V_HTML = V_HTML+ "hahahahahahahahah"
    V_HTML = V_HTML+ "</font>"
    V_HTML = V_HTML+ "</body>"
    V_HTML = V_HTML+ "</html>"

    mailto = "dave"


    mailattach = ("C:\Inetpub\wwwroot\orion\scripts\test.doc")

    V_MAIL_RESULT = SendHtmlMail("your manager",mailtoaddress,"Leave Authorisation Request [EDIT]",V_HTML,mailattach)

    and the function

    <%
    Function SendHtmlMail(mailto,mailtoaddress,subject,mailtext,mailattach)

    If Trim(mailtoaddress) <> "" Then

    Set Mailer = Server.CreateObject("SMTPsvg.Mailer")

    rem change this RemoteHost to a valid SMTP address before testing
    Mailer.RemoteHost = "smtp.intra.bt.com"
    Mailer.FromName = "BILLING SOLUTIONS"
    Mailer.FromAddress = "[email protected]"
    Mailer.AddRecipient mailto,mailtoaddress
    Mailer.Subject = subject
    Mailer.BodyText = mailtext
    Mailer.ContentType = "text/html"
    if trim(mailattach) <> "" then
    Mailer.AddAttachment mailattach
    end if

    if not Mailer.SendMail then
    SendhtmlMail = " failed... Error is: <br>" & Mailer.Response
    else
    SendhtmlMail = "Email sent successfully to "+mailto+" ["+mailtoaddress+"]"
    end if

    Set Mailer = Nothing

    Else
    SendhtmlMail = "No email address available! mail not sent."
    End If

    End Function
    %>

  2. #2
    Frenzied Member andreys's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,615
    Did you receive your attached file?

  3. #3
    Lively Member
    Join Date
    Jun 2003
    Posts
    83
    When you add an attachment, the component probably changes the content type from multipart/alternative to one of the multipart/related or something to handle the attachment. As a result, it's not processing the alternative content... so it spits out the default unformatted text.

    Check the component's literature to find out exactly how it functions with attachments. You might have to specify the content-type explicitly, or maybe it's just not possible to have an html-capable email and attachment with that component.
    - Steve

    "I'm glad I wore these pants."

  4. #4

    Thread Starter
    Fanatic Member davebat's Avatar
    Join Date
    Dec 2002
    Posts
    727
    the help file says that html emails cant be used in conjunction with addattchement.

  5. #5
    Frenzied Member andreys's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,615
    Originally posted by davebat
    the help file says that html emails cant be used in conjunction with addattchement.
    Is any other alternative e-mail components that you could use?
    Who is a hosting copmany? You may need check with them what they got on the server.

  6. #6

    Thread Starter
    Fanatic Member davebat's Avatar
    Join Date
    Dec 2002
    Posts
    727
    thanks, there is no hosting company - I sit about 10 feet away from the server. i think I might just try and use CDONTS. Ive never used it before - will this be possible or is it pretty crappy.

  7. #7
    Frenzied Member andreys's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,615
    CDONTS is a sililar thing. There are would be some programming to handle attachments. you have to upload file to the server first, and then it could be attached to the outgoing message.
    look on http://www.4guysfromrolla.com for examples.

Posting Permissions

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



Click Here to Expand Forum to Full Width