📜 ⬆️ ⬇️

Interacting with GMail for PHP

Back in 2005, a team of enthusiasts wrote the libgmailer library for interacting with Google’s mail. Unfortunately, the project was abandoned, but even so, classes allow us today to receive information about letters, labels and attachments. And the latter can even be downloaded.

For example, this is how you can download all attachments from your inbox:
$ gm = new GMailer ();
$ gm-> setLoginInfo ($ user, $ password, "+8");

if ($ gm-> connect ())
{
$ gm-> fetchBox (GM_STANDARD, "inbox", 0);
$ snapshot = $ gm-> getSnapshot (GM_STANDARD);
')
foreach ((array) $ snapshot-> box as $ item)
{
$ gm-> fetchBox (GM_CONVERSATION, $ item ["id"], 0);
$ conv_snapshot = $ gm-> getSnapshot (GM_CONVERSATION);

foreach ((array) $ conv_snapshot-> conv as $ conv)
{
for ($ i = 0; $ i <count ($ conv ["attachment"]); $ i ++)
{
$ gm-> getAttachment ($ conv ["attachment"] [$ i] ["id"], $ conv ["id"], $ conv ["attachment"] [$ i] ["filename"]);
}
}
}
}


Work on the project was terminated due to the advent of Gmail 2.0. But for now, you can fight this by setting a language other than English (US) in your account settings.

Project website: gmail-lite.sourceforge.net

Based on the Rahad Ayub library, I created the PHP Gmail Drive (PGD) tool to display and download files uploaded to GMail with programs like GMail Drive on my website.

The author's page is not available at times, but on Google Php Gmail Web Drive you can easily find the source in Google.

Source: https://habr.com/ru/post/22853/


All Articles