nulib-base/php/tbin/mail.php

27 lines
739 B
PHP
Executable File

#!/usr/bin/php
<?php
require __DIR__.'/../vendor/autoload.php';
use lib\mail\mailer;
use nur\cli\Application;
Application::run(new class extends Application {
const ARGS = [
"merge" => parent::ARGS,
["-t", "--to", "args" => 1, "action" => "--add", "name" => "to"],
["-c", "--cc", "args" => 1, "action" => "--add", "name" => "cc"],
["-b", "--bcc", "args" => 1, "action" => "--add", "name" => "bcc"],
["-F", "--from", "args" => 1, "name" => "from"],
["args" => 2, "name" => "args"],
];
protected $to, $cc, $bcc, $from;
protected $args;
function main() {
$subject = $this->args[0];
$body = $this->args[1];
mailer::send($this->to, $subject, $body, $this->cc, $this->bcc, $this->from);
}
});