Created
April 20, 2020 08:51
-
-
Save caramelchocolate/6fe819569eaacaa7ffea06ef1d1a01e6 to your computer and use it in GitHub Desktop.
mail test
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
--TEST-- | |
mail test | |
--INI-- | |
sendmail_path=./stdout.sh | |
mail.add_x_header=off | |
mail.log=./mail.log | |
--FILE-- | |
<?php | |
# pear run-tests mailtest.phpt | |
$to = '[email protected]'; | |
function encode_mimeheader($str) { | |
$str = mb_convert_encoding($str, "JIS"); | |
$str = '=?'.'iso-2022-jp?B?'. base64_encode($str) .'?='; | |
return $str; | |
} | |
function mail_header ($headers = null) { | |
$headers .= "Mime-Version: 1.0\n"; | |
$headers .= "Content-Transfer-Encoding: 7bit\n"; | |
$headers .= "Content-Type: text/plain; charset=iso-2022-jp\n"; | |
return $headers; | |
} | |
$to = '[email protected]'; | |
$body = 'body_test'; | |
$subject = 'subject_test'; | |
$subject = encode_mimeheader($subject); | |
$body = mb_convert_encoding($body, "JIS"); | |
$headers = mail_header(); | |
$add_param = '-f [email protected]'; | |
mail($to, $subject, $body, $headers, $add_param); | |
?> |
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
#!/bin/sh | |
echo "sendmail options: ${@}" | |
awk '{print $0}' < /dev/stdin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment