1. Go to this page and download the library: Download xp-framework/mail library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xp-framework / mail example snippets
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');
use peer\mail\transport\{MailTransport, TransportException};
$smtp= new MailTransport();
try {
$smtp->connect();
$smtp->send($msg);
} catch (TransportException $e) {
$e->printStackTrace();
}
$smtp->close();
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();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.