Created
November 6, 2019 06:51
-
-
Save pulketo/7c6a4889d091a47f7314871ed9467273 to your computer and use it in GitHub Desktop.
sendmail wrapper for mailx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $fechora = date("YmdHis");$o=""; | |
| $stdin = ""; | |
| while (false !== ($line = fgets(STDIN))) { | |
| $stdin.=$line; | |
| } | |
| list($H, $B) = explode(PHP_EOL.PHP_EOL, $stdin); | |
| $header = explode(PHP_EOL, $H); | |
| $body = explode(PHP_EOL, $B); | |
| foreach($header as $eachHeader){ | |
| @list($k, $v) = explode(":", $eachHeader); | |
| $k = strtolower(trim($k)); $v = trim($v); | |
| switch($k){ | |
| case "from": | |
| $from = $v; | |
| break; | |
| case "to": | |
| $to = $v; | |
| break; | |
| case "subject": | |
| $subject = $v; | |
| break; | |
| } | |
| $B = trim($B); | |
| } | |
| // $o.=print_r($H,true); | |
| // $o.=print_r($B,true); | |
| $o.=print_r($header,true); | |
| $o.=print_r($body,true); | |
| $cmd = "echo '$B' | mailx -v -r '$from' -s '$subject' -S smtp='smtp.easyname.com:587' -S smtp-use-starttls -S smtp-auth=login -S smtp-auth-user='162997mail5' -S smtp-auth-password='XPVmweG8@#..' -S ssl-verify=ignore -S nss-config-dir='/etc/pki/nssdb/' $to"; | |
| $exe = trim(`$cmd`); | |
| // $o.="cmd:$cmd"; | |
| file_put_contents("/tmp/sendmailpk.$fechora.log", $o); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment