Welcome to Geeklog, Anonymous Saturday, June 15 2024 @ 08:03 am EDT

Geeklog Forums

dummy's daily digest error


Status: offline

scroff

Forum User
Regular Poster
Registered: 02/19/03
Posts: 111
Hey folks, I know little about php, mysql or unix. But I've been reading the messages here about the Daily Digest and setting it up and believe I've done everything right. Here's the error I get mailed to me when the cron job thinger sends mail. I have a unix host. I put ./emailgeeklogstories as the command and also the full path to it and receive the same message each time. I suspect it has nothing to do with that anyway. Any info or help would be appreciated. Thanks yet again! Warning: gethostbyaddr() [http://www.php.net/function.gethostbyaddr]: Address is not a valid IPv4 or IPv6 address in /xxxx/xxxx/xxxx/xxxx/xxxx/plugins/stats/functions.inc on line 324
 Quote

Status: offline

rawdata

Forum User
Full Member
Registered: 02/17/03
Posts: 236
Are your stories being mailed out at all?
 Quote

Status: offline

scroff

Forum User
Regular Poster
Registered: 02/19/03
Posts: 111
Nothing but that error message, rawdata. I don't know if it's helpful, but line 324 is; . "', host='" . gethostbyaddr($REMOTE_ADDR)
 Quote

Status: offline

rawdata

Forum User
Full Member
Registered: 02/17/03
Posts: 236
Let's see if we can isolate what's happening. Put the below code in a file and name it testdigest.php. Place the file in the same folder as your lib-common.php. Then type in the file's URL in your browser to run it. Let me know if it sends out a digest email and whether you still get the same error message. <?php // This code snippet is responsible for emailing Geeklog stories to users // for the topics they select. // // For this script to work you must have compiled PHP so it can also be // used as a shell scripting language. You should call this script from // your crontab (man crontab). You will also need to set the exectuable // flags for this file. // Change this path to point to your lib-common.php file include('lib-common.php'); COM_emailUserTopics(); ?>
 Quote

Status: offline

scroff

Forum User
Regular Poster
Registered: 02/19/03
Posts: 111
Did as you said, got nothing. No email whatsoever. Got a blank page in my browser and no email.
 Quote

Status: offline

rawdata

Forum User
Full Member
Registered: 02/17/03
Posts: 236
Okay...you should have gotten a blank screen. No error message this time though? Interesting. You don't need to identify the directory but can you explain where emailgeeklogstories.php is located relative to the main directory? -- Is it like one or more levels above in the non-public area or one or more levels down in a public sub-directory? Since you didn't receive any email, try this. Create a new story and publish it. Make sure your username has access to the story/topic. Go inside 'Display Preferences' on the User Menu and make sure the topic box for this new story is checked. Also verify GL has a valid address for you. Then run the other script again. See if email arrives this time. Sorry, I should have put this in the previous comment. If you still get no email, then put the below script in a file and call it testemail.php. Set the $mailfrom and $mailto variables to different addresses that you own with the $mailto preferably not on the same server. Run the script and see if all six emails arrive. If not, tell me which ones don't. <?php $mailfrom = 'From: name@domain.ext'; $mailto = 'name@address.ext'; $mailtowname = '"Email Test" <' . $mailto . '>'; $mailtext = 'Dummy Message Body Text'; for ($i=1; $i<=3; $i++) { $subject = 'Test message #' . $i; $sent = mail($mailto, $subject, $mailtext, $mailfrom); if ($sent = 1) $sent = 'Yes'; else $sent = 'No'; echo("Subj: $subject ... Sent: $sent<br><br>"Wink; } for ($i=4; $i<=6; $i++) { $subject = 'Test message #' . $i; $sent = mail($mailtowname, $subject, $mailtext, $mailfrom); if ($sent = 1) $sent = 'Yes'; else $sent = 'No'; echo("Subj: $subject ... Sent: $sent<br><br>"Wink; } echo("...all done"Wink; ?>
 Quote

Anonymous

Anonymous
Hi again, and thanks for helping me out... Ok, my emailgeeklogstories.php is one level above my public directory, (/www/public_dir/... it would be in www) chmod 755. When I created a new story and signed up a new user and ran testdigest.php in the browser I received a digest email with the new story! (no error msg, cool beans!) Um, after I added new test stories... I started getting digests. I did it four times in a row... reset the cron, add a new story, and it worked fine. I thought the first time it ran it would send all the stories as new, so I didn't add a new story... I still get that error too though, in a seperate email. But the digest is going out fine. Thanks, RD, for your time and patience with a knucklehead.
 Quote

Status: offline

rawdata

Forum User
Full Member
Registered: 02/17/03
Posts: 236
Great!! I'll try to recreate the warning message and see if I can figure out what's causing it. In the meantime, I recommend you prepend an at sign to gethostbyaddr on line 324 like this: "', host='" . @gethostbyaddr($REMOTE_ADDR) I think that will stop the warning emails from being sent.
 Quote

Status: offline

scroff

Forum User
Regular Poster
Registered: 02/19/03
Posts: 111
Yup, adding that @ stopped the error emails. Seems to be working fine now. Can't thank you enough, RD. This is really cool. I have more questions... like, can the Daily Digest be formatted? Can it be a Weekly Digest (as opposed to a Daily Digest sent out weekly)? Can the comments be included? I'm like a kid in a candy store!
 Quote

Status: offline

rawdata

Forum User
Full Member
Registered: 02/17/03
Posts: 236
To make it a weekly digest just adjust your cron job to run once a week instead of everyday. To format it into html or add comments would require rewriting COM_emailUserTopics.
 Quote

All times are EDT. The time is now 08:03 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content