PHP Classes

Viv OAuth IMAP: Access messages in IMAP server using OAuth token

Recommend this page to a friend!
  Info   View files View files (87)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-01-09 (3 days ago) RSS 2.0 feedNot enough user ratingsTotal: 683 This week: 3All time: 4,757 This week: 141Up
Version License PHP version Categories
viv-oauth-imap 1.0.11MIT/X Consortium ...5Email
Description 

Author

This class can access email messages in an IMAP server using an OAuth token.

It can connect to a IMAP server authenticating with either a user name and password or using a previously obtained OAuth token.

The class can also perform other operations with the IMAP server mailbox like listing folders, selecting folders to access, getting the total of emails in a folder, getting the headers and bodies of email messages, logout and disconnect.

Innovation Award
PHP Programming Innovation award nominee
November 2013
Number 3


Prize: One copy of the Zend Studio
IMAP is a popular protocol for accessing servers that receive email messages for users.

OAuth is a protocol that is used to obtain permission from an user to access server resources on his behalf.

This class can access to a IMAP server that supports user authentication using OAuth tokens.

Manuel Lemos
Picture of Vivek Muthal
  Performance   Level  
Name: Vivek Muthal <contact>
Classes: 1 package by
Country: India India
Innovation award
Innovation award
Nominee: 1x

Details

# VivOAuthIMAP ####Version: 1.0 ##Overview VivOAuthIMAP is a library to support OAuth for IMAP. PHP's default library imap_open doesn't have support for OAuth. So a quiick solution will be this library. ###Features * Connect to IMAP using OAuth * Count Total Mails * Fetch Mails Headers * Fetch Mails Body * List folders of mailbox * Switch to folders easily * Append Message ###Usage $imap = new VivOAuthIMAP(); $imap->host = 'ssl://imap.gmail.com'; $imap->port = 993; //Using Username And Password $imap->username = 'changeMe@gmail.com'; $imap->password = 'changeMe'; //Or you can use access token //$imap->accessToken = 'tokenreceivedbyoauthlibrary' if ($imap->login()) { /* $header = $imap->getHeader(1); //Returns mail header array $mails = $imap->getMessage(1); //Returns mails array $headers = $imap->getHeaders(1,10); //Returns mail headers array $mails = $imap->getMessage(2); //Returns mails array $total = $imap->totalMails(); //By default inbox is selected $total = $imap->totalMails('Folder Name'); //Any folder which exist can be passed as folder name $folders = $imap->listFolders(); //Lists all folders of mailbox $imap->selectFolder('Folder Name'); // Default is INBOX autoselected after login */ $mails = $imap->getMessages(1, 20); foreach ($mails as $mail) { //Using mime_parser you can parse the rfc822 format mail or can write own parser //Here in example used a mime_parser_class $mime = new mime_parser_class(); $parameters = array('Data' => $mail); $mime->Decode($parameters, $decoded); /* //See how much variables you can access echo "<pre>"; print_r($decoded); echo "</pre>"; */ echo "<b>From :</b> " . $decoded[0]['ExtractedAddresses']['from:'][0]['address'] . " "; echo "<b>Subject :</b> " . $decoded[0]['Headers']['subject:'] . "<br>"; echo "======================================================== <br>"; } } ##Requirement * PHP Version > PHP 5.3+ * PHP Extensions needs to enable * php_openssl * php_curl * php_sockets ##License ---- The MIT License (MIT) Copyright (c) 2013 Vivek Muthal Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Author : Vivek Muthal Email : vmuthal.18@gmail.com Website : [www.vivsoftware.in](http://www.vivsoftware.in)

  Files folder image Files  
File Role Description
Files folder imageexample (1 file, 2 directories)
Files folder imagenbproject (2 files, 1 directory)
Files folder imagesrc (1 file)
Accessible without login Plain text file License.txt Doc. Documentation
Accessible without login Plain text file README.md Data Auxiliary data

  Files folder image Files  /  example  
File Role Description
Files folder imageGoogleClient (2 files, 6 directories)
Files folder imagelib (2 files)
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files  /  example  /  GoogleClient  
File Role Description
Files folder imageauth (9 files)
Files folder imagecache (4 files)
Files folder imagecontrib (48 files)
Files folder imageexternal (1 file)
Files folder imageio (7 files)
Files folder imageservice (6 files)
  Accessible without login Plain text file config.php Example Example script
  Accessible without login Plain text file Google_Client.php Example Example script

  Files folder image Files  /  example  /  GoogleClient  /  auth  
File Role Description
  Accessible without login Plain text file Google_AssertionCredentials.php Example Example script
  Accessible without login Plain text file Google_Auth.php Example Example script
  Accessible without login Plain text file Google_AuthNone.php Example Example script
  Accessible without login Plain text file Google_LoginTicket.php Example Example script
  Accessible without login Plain text file Google_OAuth2.php Example Example script
  Accessible without login Plain text file Google_P12Signer.php Example Example script
  Accessible without login Plain text file Google_PemVerifier.php Example Example script
  Accessible without login Plain text file Google_Signer.php Example Example script
  Accessible without login Plain text file Google_Verifier.php Example Example script

  Files folder image Files  /  example  /  GoogleClient  /  cache  
File Role Description
  Accessible without login Plain text file Google_ApcCache.php Example Example script
  Accessible without login Plain text file Google_Cache.php Example Example script
  Accessible without login Plain text file Google_FileCache.php Example Example script
  Accessible without login Plain text file Google_MemcacheCache.php Example Example script

  Files folder image Files  /  example  /  GoogleClient  /  contrib  
File Role Description
  Accessible without login Plain text file Google_AdexchangebuyerService.php Example Example script
  Accessible without login Plain text file Google_AdExchangeSellerService.php Example Example script
  Accessible without login Plain text file Google_AdsensehostService.php Example Example script
  Accessible without login Plain text file Google_AdSenseService.php Example Example script
  Accessible without login Plain text file Google_AnalyticsService.php Example Example script
  Accessible without login Plain text file Google_AndroidpublisherService.php Example Example script
  Accessible without login Plain text file Google_AppstateService.php Example Example script
  Accessible without login Plain text file Google_AuditService.php Example Example script
  Accessible without login Plain text file Google_BigqueryService.php Example Example script
  Accessible without login Plain text file Google_BloggerService.php Example Example script
  Accessible without login Plain text file Google_BooksService.php Example Example script
  Accessible without login Plain text file Google_CalendarService.php Example Example script
  Accessible without login Plain text file Google_CivicInfoService.php Example Example script
  Accessible without login Plain text file Google_ComputeService.php Example Example script
  Accessible without login Plain text file Google_CoordinateService.php Example Example script
  Accessible without login Plain text file Google_CustomsearchService.php Example Example script
  Accessible without login Plain text file Google_DatastoreService.php Example Example script
  Accessible without login Plain text file Google_DfareportingService.php Example Example script
  Accessible without login Plain text file Google_DirectoryService.php Example Example script
  Accessible without login Plain text file Google_DriveService.php Example Example script
  Accessible without login Plain text file Google_FreebaseService.php Example Example script
  Accessible without login Plain text file Google_FusiontablesService.php Example Example script
  Accessible without login Plain text file Google_GamesManagementService.php Example Example script
  Accessible without login Plain text file Google_GamesService.php Example Example script
  Accessible without login Plain text file Google_GanService.php Example Example script
  Accessible without login Plain text file Google_GroupssettingsService.php Example Example script
  Accessible without login Plain text file Google_LicensingService.php Example Example script
  Accessible without login Plain text file Google_MirrorService.php Example Example script
  Accessible without login Plain text file Google_ModeratorService.php Example Example script
  Accessible without login Plain text file Google_Oauth2Service.php Example Example script
  Accessible without login Plain text file Google_OrkutService.php Example Example script
  Accessible without login Plain text file Google_PagespeedonlineService.php Example Example script
  Accessible without login Plain text file Google_PlusDomainsService.php Example Example script
  Accessible without login Plain text file Google_PlusService.php Example Example script
  Accessible without login Plain text file Google_PredictionService.php Example Example script
  Accessible without login Plain text file Google_ReportsService.php Example Example script
  Accessible without login Plain text file Google_ResellerService.php Example Example script
  Accessible without login Plain text file Google_ShoppingService.php Example Example script
  Accessible without login Plain text file Google_SiteVerificationService.php Example Example script
  Accessible without login Plain text file Google_SQLAdminService.php Example Example script
  Accessible without login Plain text file Google_StorageService.php Example Example script
  Accessible without login Plain text file Google_TaskqueueService.php Example Example script
  Accessible without login Plain text file Google_TasksService.php Example Example script
  Accessible without login Plain text file Google_TranslateService.php Example Example script
  Accessible without login Plain text file Google_UrlshortenerService.php Example Example script
  Accessible without login Plain text file Google_WebfontsService.php Example Example script
  Accessible without login Plain text file Google_YouTubeAnalyticsService.php Example Example script
  Accessible without login Plain text file Google_YouTubeService.php Example Example script

  Files folder image Files  /  example  /  GoogleClient  /  external  
File Role Description
  Accessible without login Plain text file URITemplateParser.php Example Example script

  Files folder image Files  /  example  /  GoogleClient  /  io  
File Role Description
  Accessible without login Plain text file cacerts.pem Data Auxiliary data
  Accessible without login Plain text file Google_CacheParser.php Example Example script
  Accessible without login Plain text file Google_CurlIO.php Example Example script
  Accessible without login Plain text file Google_HttpRequest.php Example Example script
  Accessible without login Plain text file Google_HttpStreamIO.php Example Example script
  Accessible without login Plain text file Google_IO.php Example Example script
  Accessible without login Plain text file Google_REST.php Example Example script

  Files folder image Files  /  example  /  GoogleClient  /  service  
File Role Description
  Accessible without login Plain text file Google_BatchRequest.php Example Example script
  Accessible without login Plain text file Google_MediaFileUpload.php Example Example script
  Accessible without login Plain text file Google_Model.php Example Example script
  Accessible without login Plain text file Google_Service.php Example Example script
  Accessible without login Plain text file Google_ServiceResource.php Example Example script
  Accessible without login Plain text file Google_Utils.php Example Example script

  Files folder image Files  /  example  /  lib  
File Role Description
  Accessible without login Plain text file mime_parser.php Example Example script
  Accessible without login Plain text file rfc822_addresses.php Example Example script

  Files folder image Files  /  nbproject  
File Role Description
Files folder imageprivate (2 files)
  Accessible without login Plain text file project.properties Data Auxiliary data
  Accessible without login Plain text file project.xml Data Auxiliary data

  Files folder image Files  /  nbproject  /  private  
File Role Description
  Accessible without login Plain text file private.properties Data Auxiliary data
  Accessible without login Plain text file private.xml Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
  Plain text file VivOAuthIMAP.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:683
This week:3
All time:4,757
This week:141Up