The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Cron Job won't send HTML in emails
Mavrik347
post Mar 15 2011, 04:46 PM
Post #1


Member
***

Group: Members
Posts: 31
Joined: 24-November 06
Member No.: 1,107



Hi guys, I can't work this one out.

I've tried all sorts of cron commands and none have worked so I've removed them so it's back to this:
0 0 * * * php /home/sever/public_html/functions/cron/dotlan_update.php


But every time it sends me an e-mail I get this:
QUOTE
X-Powered-By: PHP/5.2.17
Content-type: text/html

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN'><html><head><title>DOTLAN Update</title><meta http-equiv='content-type' content='text/html;charset=UTF-8' /></head><body><strong>Updated successfully: 15th of March 2011 9:42pm GMT</strong></body></html>


It won't show it as I want it to, like this:
Updated successfully: 15th of March 2011 9:42pm GMT

Does anyone know how to make the cron send an email properly in html? My mail client does accept it as I have had news letters off website that have been in HTML.

sad.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Mar 15 2011, 11:58 PM
Post #2


WDG Member
********

Group: Root Admin
Posts: 8,344
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



If you can see the X-Powered-By and Content-type headers, then they aren't being included as headers properly. It looks like the headers are being included as part of the email body, rather than as headers.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Mavrik347
post Mar 16 2011, 12:17 PM
Post #3


Member
***

Group: Members
Posts: 31
Joined: 24-November 06
Member No.: 1,107



Aha, would you have any idea how to address this? The "X-Powered-By: PHP/5.2.17 + Content-type: text/html" part are not in the actual page I have made, so I think they are actually in the cron system as it were.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Mavrik347
post Mar 18 2011, 07:54 PM
Post #4


Member
***

Group: Members
Posts: 31
Joined: 24-November 06
Member No.: 1,107



No one knows?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Mar 19 2011, 12:20 AM
Post #5


Jocular coder
********

Group: Members
Posts: 2,329
Joined: 31-August 06
Member No.: 43



Cron is just a scheduler -- it doesn't "send emails". You need to debug the program dotlan_update.php

If you wrote it yourself, you can ask for specific help, or if you got it from somewhere you probably need to get help from whoever wrote it.

If you don't know what "debug" means, ... ah well, that may be the problem.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Mavrik347
post Mar 19 2011, 02:16 PM
Post #6


Member
***

Group: Members
Posts: 31
Joined: 24-November 06
Member No.: 1,107



I did build it myself. I do know what debugging is (have used it in game dev). But never in php:

ini_set('display_errors', 'On');
error_reporting(E_ALL | E_STRICT);

Is this what you mean? If so as expected I didn't get any errors except "Strict Standards: date_default_timezone_get() [function.date-default-timezone-get]: It is not safe to rely on the system's timezone settings." Which I'm not bothered about tongue.gif I always check for errors when building something and i do it after implementing or changing anything.

Not sure how I would make the page have headers though... Haven't come across that need until now.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Mar 19 2011, 03:01 PM
Post #7


Jocular coder
********

Group: Members
Posts: 2,329
Joined: 31-August 06
Member No.: 43



No, debugging simply means working out what's going on. If there is a function that's supposed to send an email, echo something, the parameters for example at the beginning of the function body. If this appears, the function is being called. Etc etc.

You might try running the update program directly from the command line, so you can see error output. Or you might have to echo debugging messages to a log file.

I expect those headers are produced by the call to mail() -- you need to look up the documentation on that.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 26th July 2021 - 12:05 AM