(First time programming in PHP. Had some help. Need a bit more.)
Goal:
Pull the lastContactDate from a given email address from my gmail accou
Problem solved!
Here's the solution. Using the original code above, we only modified the location in which our program searches. Instead of INBOX, it's:
/* connect to gmail */
$gmailhostname = '{imap.gmail.com:993/imap/ssl}[Gmail]/All Mail';
Specifically
[Gmail]/All Mail
Found the syntax here: http://php.net/manual/en/function.imap-delete.php
But would not have been possible without Ben's epic solution below.. In large part for this bit:
//You can find out what folders are available with this command:
print_r(imap_list($conn, $gmailhostname, '*'));
print_r listed all the folders in my account by name. We spotted "All Mail", in my case - 22,000+, found a sample piece of code on php.net with the syntax, plugged it in and viola!
Thanks to mmmshuddup for cleaning my code and especially Ben for the enormous researching effort and leading solutions.
This is fun as hell.