How to Include plain html web page into body

Help
2012-01-22
2012-09-18
  • Jacques Mulder

    Jacques Mulder - 2012-01-22

    hi

    I've bee using phpmailer for some time now.

    But now I want to take it further.

    We create marketing pages and want to include it into the $mail->Body function
    for example

    Like this $mail->Body = include ("index.html");

    But this does not work. Is there another method other than recreating the the
    whole page as an echo into the body function.

    If I can do it as an include then it would be more dynamic and all I have to
    do is change my index.html page and when I mail it with phpmailer It changes
    dynamically.

    If I have to hardcode the index.html file with echoes into the body function I
    would have to change it all the time when the original index.html page changes
    else the html output to the email would not correspond

    Thanks

    Jacques

     
  • Ooypunk

    Ooypunk - 2012-01-22

    That won't work, include() doesn't give output as you want it here (or you'd
    have to catch it with output buffering).

    Try file_get_contents().

     
  • Jacques Mulder

    Jacques Mulder - 2012-01-22

    Thank you, file_get_contents() works 100%

    Just a note to anyone else wanting to do it this way.

    It's best not to include css styles in your original html page you want to
    mail via phpmailer.

    But rather to style your text inside the font tags.

    And to use tables to control positioning in the email body instead of css

    Happy Mailing

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks