Mercurial > hg > rc1
comparison vendor/pear/mail_mime/scripts/phail.php @ 0:1e000243b222
vanilla 1.3.3 distro, I hope
| author | Charlie Root |
|---|---|
| date | Thu, 04 Jan 2018 15:50:29 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:1e000243b222 |
|---|---|
| 1 #!@prefix@/bin/php -Cq | |
| 2 <?php | |
| 3 /** | |
| 4 * PHAIL - stands for PHP Mail | |
| 5 * @author Tomas V.V.Cox <cox@idecnet.com> | |
| 6 */ | |
| 7 require_once 'Mail.php'; | |
| 8 require_once 'Mail/mime.php'; | |
| 9 require_once 'Console/Getopt.php'; | |
| 10 | |
| 11 $argv = Console_Getopt::readPHPArgv(); | |
| 12 $opts = Console_Getopt::getOpt($argv, 'f:c:s:t:a:b:'); | |
| 13 if (PEAR::isError($opts)) { | |
| 14 usage($opts->getMessage()); | |
| 15 } | |
| 16 | |
| 17 PEAR::setErrorHandling(PEAR_ERROR_DIE); | |
| 18 $mime = new Mail_mime; | |
| 19 foreach ($opts[0] as $opt) { | |
| 20 $param = $opt[1]; | |
| 21 switch ($opt[0]) { | |
| 22 case 'f': | |
| 23 $headers['From'] = $param; break; | |
| 24 case 'c': | |
| 25 $headers['Cc'] = $param; break; | |
| 26 case 's': | |
| 27 $headers['Subject'] = $param; break; | |
| 28 case 't': | |
| 29 $to = $param; break; | |
| 30 case 'a': | |
| 31 $mime->addAttachment($param); break; | |
| 32 case 'b': | |
| 33 $isfile = @is_file($param) ? true : false; | |
| 34 $mime->setTXTBody($param, $isfile); break; | |
| 35 } | |
| 36 } | |
| 37 | |
| 38 $mbody = $mime->get(); | |
| 39 $headers = $mime->headers($headers); | |
| 40 $mail = Mail::factory('mail'); | |
| 41 $mail->send($to, $headers, $mbody); | |
| 42 | |
| 43 function usage($error) | |
| 44 { | |
| 45 die($error); | |
| 46 } | |
| 47 ?> |
