Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

18,476 Commits

Repository files navigation

Mail for XP

Build status on GitHubXP Framework ModuleBSD LicenceRequires PHP 7.0+Supports PHP 8.0+Latest Stable Version

E-Mail APIs, POP3, IMAP, MailDir, SMTP support.

Creating an email

usepeer\mail\{Message, InternetAddress};
$msg= newMessage();
$msg->setFrom(newInternetAddress('friebe@example.com', 'Timm Friebe'));
$msg->addRecipient(TO, newInternetAddress('foo@bar.baz', 'Foo Bar'));
$msg->addRecipient(CC, newInternetAddress('timm@foo.bar', 'Timm Friebe'));
$msg->setHeader('X-Binford', '6100 (more power)');
$msg->setSubject('Hello world');
$msg->setBody('Testmail');

Sending email

usepeer\mail\transport\{MailTransport, TransportException};
$smtp= newMailTransport();
try {
$smtp->connect();
$smtp->send($msg);
} catch (TransportException$e) {
$e->printStackTrace();
}
$smtp->close();

Using an SMTP server

usepeer\mail\transport\{SmtpConnection, TransportException};
$smtp= newSmtpConnection('esmtp://user:pass@mail.example.com:25/?auth=login');
try {
$smtp->connect();
$smtp->send($msg);
} catch (TransportException$e) {
$e->printStackTrace();
}
$smtp->close();

About

E-Mail APIs, POP3, IMAP, MailDir, SMTP support for the XP Framework

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages