- encapsulates IMAP/POP3/… connections
- provides abstraction layer for MimeMessages / Mailbox-Folders
- depends on PECL/mailparse Library
- IMAP (ImapConnector)
- POP3 (Pop3Connector) - not yet implemented
- access to mailbox folders, including their intire messages and subfolders (self-referencing)
- see Entity/Folder.php for complete fieldlist
- access to mails, including raw content (mime-parts) & headers
- see Entity/MimeMessage.php for complete fieldlist
- install doc see: installation-chapter
- configuration doc see: configuration-chapter
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:
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
)
);
}
...
}