HTML attachment in an email using asp

asp India
  • 14 years ago

    Hi all,

    I have an asp page which sends an email .

    I want to attach an html attachment to the email.

    The content of the attachment must be fetched from database.

    i.e. i need to create an html file using a record set.

    Any help will be appreciated.

    Thanking you ij anticipation,

    kris.

  • 14 years ago

    hello .

    help me understand something : do you want to send an html  file or a simple mail with an html body

    serval

  • 14 years ago

    HI Kris

    Use CDONTS to send a HTML based email message.You'll get the general idea..notice how you have to add extra double quotes inside the HTML. You can use any valid HTML. Just make sure you link the images back to your webserver so that the recipient doesn't get a broken image. If the recipient's email program doesn't support HTML this is not always a good way to send

    <%
        Dim MyCDONTSMail2
        Dim HTML
        Set MyCDONTSMail2 = CreateObject("CDONTS.NewMail")
        HTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"
        HTML = HTML & "<html>"
        HTML = HTML & "<head>"
        HTML = HTML & "<title>Sending CDONTS Email Using HTML</title>"
        HTML = HTML & "</head>"
        HTML = HTML & "<body bgcolor=""FFFFFF"">"
        HTML = HTML & "<p><font size =""3"" face=""Arial""><strong>"
        HTML = HTML & "Name Of Store</strong><br>"
        HTML = HTML & "Incoming Customer Order</strong></p>"
        HTML = HTML & "<p align = ""center"">Bla Bla Bla Bla Bla</p>"
        HTML = HTML & "</body>"
        HTML = HTML & "</html>"
        MyCDONTSMail2.From= "[email protected]"
        MyCDONTSMail2.To="[email protected]"
        MyCDONTSMail2.Subject="Incoming Customer Order"
        MyCDONTSMail2.BodyFormat=0
        MyCDONTSMail2.MailFormat=0
        MyCDONTSMail2.Body=HTML
        MyCDONTSMail2.Send
        set MyCDONTSMail2=nothing
    %>























    Regards

    DoctorMahdi

  • 14 years ago

    By the way , can you tell me more about your database content : what kind of dats do you want to retrieve ?

    1. do you have have a text field where you already have html formated  datas?
    2. do you have raw text in your database ?

    serval

     

     

     

  • 14 years ago

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debuggers don't remove bugs. They only show them in slow motion.”