I am trying to fetch any emails received and sent, and write it to the mySQL database using PHP.
The hostname I am using is:
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
Which is referencing just the inbox, and successfully grabs just emails received.
To grab emails sent, I am trying to use this hostname:
$hostname = '{imap.gmail.com:993/imap/ssl}[Gmail]/All Mail';
By replacing "INBOX" with "[Gmail]/All Mail", no emails (not even sent) and being returned.
How do I grab all emails sent and received?
$host = '{imap.gmail.com:993/ssl}';
$mail_con = imap_open($host, $login, $password);
$mailboxes = imap_list($mail_con, $host, '*');
You can get array like this
Array(
[0] => {imap.gmail.com:993/ssl}INBOX
[1] => {imap.gmail.com:993/ssl}Personal
[2] => {imap.gmail.com:993/ssl}Servers
[3] => {imap.ipage.com:993/imap/ssl}INBOX.Sent Items
[4] => {imap.ipage.com:993/imap/ssl}INBOX.Drafts
)
remove above code and Use any array in imap_open like this
$host = '{imap.gmail.com:993/ssl}INBOX.Sent';
$mail_con = imap_open($host, $login, $password);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With