The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

cron sends html source not a html email

Discussion in 'E-mail Discussions' started by ctbhost, Dec 31, 2004.

  1. ctbhost

    ctbhost Well-Known Member

    Joined:
    May 31, 2002
    Messages:
    139
    Likes Received:
    0
    Trophy Points:
    16
    i have setup a cron job to yrun a php script - the scrip, if run from a browser shows the results fine but when the cron runs it - the email i get has just the source code in it rather than a html page. how do i get it to send as a html email ???

    i get


    Content-type: text/html
    X-Powered-By: PHP/4.3.9

    <html>
    <title>the hello page</title>
    <head>
    <body>
    hello world
    </body>
    </html>


    instead of just

    hello world


    any advise would be great
     
  2. elleryjh

    elleryjh Well-Known Member

    Joined:
    Apr 12, 2003
    Messages:
    479
    Likes Received:
    0
    Trophy Points:
    16
    I don't think there's any way to send html mail with cron. I suppose you could send the email in the script and have no output. My advice would be to just remove all the html from the script that is being run in cron.
     
  3. ctbhost

    ctbhost Well-Known Member

    Joined:
    May 31, 2002
    Messages:
    139
    Likes Received:
    0
    Trophy Points:
    16
    :D thats a good idea - didnt think of that

    Thanks
     
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Indeed. If you want HTML emails, you'll need to modify your PHP script to send out the email and set the content-type in the email header to text/html. You cannot expect cron to do that, it simply sends a plain text email when reporting output.
     
Loading...

Share This Page