Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xp-framework/mail
E-Mail APIs, POP3, IMAP, MailDir, SMTP support for the XP Framework
https://github.com/xp-framework/mail
imap maildir php pop smtp xp-framework
Last synced: about 1 month ago
JSON representation
E-Mail APIs, POP3, IMAP, MailDir, SMTP support for the XP Framework
- Host: GitHub
- URL: https://github.com/xp-framework/mail
- Owner: xp-framework
- Created: 2013-11-12T11:08:15.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2022-02-27T10:17:35.000Z (almost 3 years ago)
- Last Synced: 2024-10-28T12:50:30.703Z (about 2 months ago)
- Topics: imap, maildir, php, pop, smtp, xp-framework
- Language: PHP
- Size: 3.21 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
Awesome Lists containing this project
README
Mail for XP
===========[![Build status on GitHub](https://github.com/xp-framework/mail/workflows/Tests/badge.svg)](https://github.com/xp-framework/mail/actions)
[![XP Framework Module](https://raw.githubusercontent.com/xp-framework/web/master/static/xp-framework-badge.png)](https://github.com/xp-framework/core)
[![BSD Licence](https://raw.githubusercontent.com/xp-framework/web/master/static/licence-bsd.png)](https://github.com/xp-framework/core/blob/master/LICENCE.md)
[![Requires PHP 7.0+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-7_0plus.svg)](http://php.net/)
[![Supports PHP 8.0+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-8_0plus.svg)](http://php.net/)
[![Latest Stable Version](https://poser.pugx.org/xp-framework/mail/version.png)](https://packagist.org/packages/xp-framework/mail)E-Mail APIs, POP3, IMAP, MailDir, SMTP support.
## Creating an email
```php
use peer\mail\{Message, InternetAddress};$msg= new Message();
$msg->setFrom(new InternetAddress('[email protected]', 'Timm Friebe'));
$msg->addRecipient(TO, new InternetAddress('[email protected]', 'Foo Bar'));
$msg->addRecipient(CC, new InternetAddress('[email protected]', 'Timm Friebe'));
$msg->setHeader('X-Binford', '6100 (more power)');
$msg->setSubject('Hello world');
$msg->setBody('Testmail');
```## Sending email
```php
use peer\mail\transport\{MailTransport, TransportException};$smtp= new MailTransport();
try {
$smtp->connect();
$smtp->send($msg);
} catch (TransportException $e) {
$e->printStackTrace();
}$smtp->close();
```## Using an SMTP server
```php
use peer\mail\transport\{SmtpConnection, TransportException};$smtp= new SmtpConnection('esmtp://user:[email protected]:25/?auth=login');
try {
$smtp->connect();
$smtp->send($msg);
} catch (TransportException $e) {
$e->printStackTrace();
}$smtp->close();
```