My company uses script-generated emails to correspond with clients. Until now, we've had to manually sort through these emails, look up client info, print and file them. I'm writing a script that does this automatically and it was working fine until 10 minutes ago when Google stopped sending the subject with imap_fetch_overview()
.
Here's how I'm doing it:
$msgov=imap_fetch_overview($inbox,$uid,FT_UID);
$msgsub= $msgov[0]->subject;
$msgfr= $msgov[0]->from;
$msgid= $msgov[0]->uid;
$message = imap_fetchbody($inbox,$uid,1,FT_UID);
//echo message info, then message
echo "...";
And that worked fine until about 10 minutes ago when I started getting this error: Notice: Undefined property: stdClass::$subject in C:\wamp\www\gmil\index.php on line 113
So I proceed to echo var_dump($msgov);
and suddenly it's not showing the subject anymore.. According to The Manual it should be giving me the subject. Am I doing something wrong or am I just unlucky enough to be doing this at the exact time Google decided to stop sending it?
I'm dumb. After one message not didn't contain a subject, it stopped checking for that value in all subsequent loops. I solved it like this:
if(isset($overview[0]->subject)){$sub=$overview[0]->subject;}else{$sub="No Subject";}
and then called $sub
instead of $overview[0]->subject
.