Forum Moderators: bakedjake
Here's the issue. The script runs fine when I type it in as a URL (www.example.com/folder/script.php) - email delivered fine and everything. And as a cronjob, it runs fine too, when it's tested by my webhost's tech support people (it emails them), but it will NOT email me.
I've tried 3 different email addresses, no dice. Not in the inbox, and not in the spam filter. But when the tech support person uses her personal Yahoo email address, it works fine for her.
Huh? Any ideas?
Thanks,
Joe
I can run it fine manually, but I just run it from a browser, not the shell.
Joe
If that's the problem, you may be able to remove it from the script and hard-code the necessary data. Or, you may be able to use curl or wget to call the URL from cron, which would act the same as calling it from your Web browser.
include "../config/config.php";
include "../includes/class.db.php";
include "../includes/functions.php";
$db = new db();
$data = $db->get_all_rows('lead_buyer="ed" AND featured_school="1"', 'aa_institution');
$errors = '';
foreach ($data as $school) {
$page = visit($school['form_url']);
if ($page == "NO") {
$errors = $errors.$school['institution_name'].' is blah blah blah';
}
}
if ($errors == '') {
exit();
} else {
$to = 'joe@example.com';
$subj = "blah blah blah";
$mess = "";
$mess = $errors;
$headers = "";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers = "content-type:text/html; charset=UTF-8 \r\n";
$headers = "From: ".$_POST['email']."\r\n";
$headers = "To: ".$to."\r\n";
$headers = "Return-Path: ".$_POST['email'];
$to_return = "-f".$to;
mail($to, $subj, $mess, $headers, "-f".$to);
}
exit();
I can't figure out why a cronjob would care which email address it was sending results to - since it apparently works fine when the tech puts her own email address in - she waited for it to execute at the schedule time, and it executed, and sent her an email.
If it matters, the web host console I'm using is DirectAdmin.
Argh.
Joe