symfony-bundle mailbox-connection-bundle
A Symfony2 Bundle mailbox communication by imap/pop3.
digitalshift/mailbox-connection-bundle
A Symfony2 Bundle mailbox communication by imap/pop3.
- Sunday, June 5, 2016
- by soeren-helbig
- Repository
- 1 Watchers
- 0 Stars
- 17 Installations
- PHP
- 2 Dependents
- 0 Suggesters
- 1 Forks
- 1 Open issues
- 2 Versions
- 0 % Grown
DigitalshiftMailboxConnectionBundle
- encapsulates IMAP/POP3/… connections
- provides abstraction layer for MimeMessages / Mailbox-Folders
- depends on PECL/mailparse Library
Supported Mailbox Connections / Protocols
- IMAP (ImapConnector)
- POP3 (Pop3Connector) - not yet implemented
Abstraction-Layer
Mailbox - Folder
- access to mailbox folders, including their intire messages and subfolders (self-referencing)
- see Entity/Folder.php for complete fieldlist
MimeMessage
- access to mails, including raw content (mime-parts) & headers
- see Entity/MimeMessage.php for complete fieldlist
Installation / Configuration
Basic Usage
The main access point is the digitalshift_mailbox_client.connector
-service. It encapsulates your mailbox-connection and internally uses factories to build Folder- and MimeMessage-instances by the recieved mailbox data. In your controller (for example), you can do things like that:, (*1)
class DefaultController extends Controller
{
...
public function indexAction()
{
/** @var ImapConnector $imapConnector */
$imapConnector = $this->get('digitalshift_mailbox_client.connector');
$folder = $imapConnector->getFolder();
// OR
$folder = $imapConnector->getFolder('INBOX');
$message = $imapConnector->getMessage(1);
// OR
$message = $imapConnector->getMessage(1, 'INBOX');
// Folder
$folder->getName();
$folder->getPath();
$folder->getMessages();
$folder->getFolders();
// Message
$message->getHeader();
$message->getContent();
$message->getSubject();
$message->getHtmlContent();
$message->getPlainContent();
return $this->render(
'DigitalshiftMailerBundle:Default:index.html.twig',
array(
'message' => $message,
'folder' => $folder
)
);
}
...
}