Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

No email on job completion

$
0
0

Replies: 0

I have 4 cron jobs set up, they all run and I can see the output in the log.

3 of the jobs send email on completion, but one does not. The email system id SendGrid, so I can see that the email is never sent from the site.

Any ideas what would prevent email from being sent?

This is the offending script:
<?php
// config
$user = “xxxx” ;
$pass = “xxxx” ;
$db = “xxxx” ;
$host = “127.0.0.1” ;
$charset = “utf8”;

$dsn = “mysql:host=$host;dbname=$db;charset=$charset”;
$opt = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
];
$usrconn = new PDO($dsn, $user, $pass, $opt);
$orgconn = new PDO($dsn, $user, $pass, $opt);
$yesterday = date(“Y-m-d”, strtotime(“-1 days”));
echo “Yesterday: ” . $yesterday;
echo “<br>”;
$user_q = “SELECT * FROM wp_xxx_users WHERE user_registered LIKE ‘” . $yesterday . “%'”;
$newbies = $usrconn->query($user_q);
while ($row = $newbies->fetch()) {
$userId = $row[ID];
$loc_q = “SELECT meta_value FROM wp_xxx_usermeta WHERE user_id LIKE ‘” . $userId . “‘ AND meta_key LIKE ‘sc_cf_organization’ LIMIT 1″;
// echo $loc_q;
$locs = $orgconn->query($loc_q);
$orgId = $locs->fetch();
$orgName = “No Org”;
if($orgId[meta_value] !=””){
$org_q = “SELECT post_title FROM wp_xxxx_posts WHERE id LIKE ‘” . $orgId[meta_value] . “‘”;
$org = $orgconn->query($org_q);
$orgInfo = $org->fetch();
}
echo ” – ” . $row[display_name] . ” – ” . $row[user_email] . ” – ” . $orgInfo[post_title] . “<br>”;
}
echo “End of List”;
?>


Viewing all articles
Browse latest Browse all 59525

Trending Articles