ljpc/mail-grabber

This library adds the functionality to receive and send mails with PHP.

1.0.2 2016-06-16 18:08 UTC

This package is not auto-updated.

Last update: 2019-03-16 07:28:57 UTC


README

This library adds the functionality to receive and send mails with PHP.

Sample code:

<?php
require "vendor/autoload.php";
require "config.php";

if (!isset($_REQUEST['criteria'])) {
    $_REQUEST['criteria'] = 'ALL';
}
$mail = new Mail();

$mails = $mail->fetch($_REQUEST['criteria']);

$mail->send(["From", "webmaster@example.com"], [["To", "me1@example.com"], ["To 2", "me2@example.com"]], "Subject", "Text", "HTML");

if (isset($_REQUEST['xml'])) {
    $xml_data = new SimpleXMLElement('<?xml version="1.0"?><data></data>');
    echo $mail->show_as_xml($mails, $xml_data);
    exit;
}

echo $mail->show_as_json($mails);
exit;
?>