{"id":223,"date":"2010-02-26T14:25:32","date_gmt":"2010-02-26T05:25:32","guid":{"rendered":"http:\/\/clouds.tokyo\/blog\/?p=223"},"modified":"2017-02-28T17:36:09","modified_gmt":"2017-02-28T08:36:09","slug":"php_sendmail","status":"publish","type":"post","link":"https:\/\/clouds.tokyo\/blog\/php_sendmail\/","title":{"rendered":"\u3010PHP\u3011\u30b7\u30f3\u30d7\u30eb\u306b\u30e1\u30fc\u30eb\u9001\u4fe1"},"content":{"rendered":"<p>\u30b7\u30f3\u30d7\u30eb\u306a\u65e5\u672c\u8a9e\u30e1\u30fc\u30eb\u9001\u4fe1\u30af\u30e9\u30b9\u3067\u3059\u3002\u30b5\u30fc\u30d0\u30fc\u306e\u6587\u5b57\u30b3\u30fc\u30c9\u306fUTF-8\u3068\u3057\u305f\u5834\u5408\u3002<\/p>\n<pre>\r\nclass mailsender {\r\n\r\n  private $mail_to = null;\r\n  private $from = null;\r\n  private $from_name = null;\r\n  private $subject = '(\u4ef6\u540d\u306a\u3057)';\r\n  private $body = '(\u672c\u6587\u306a\u3057)';\r\n\r\n  function set_mail_to($val) {\r\n    $this->mail_to = $val;\r\n  }\r\n\r\n  function set_from($f, $fn = null) {\r\n    $this->from = $f;\r\n    $this->from_name = $fn;\r\n  }\r\n\r\n  function set_subject($val) {\r\n    $this->subject = $val;\r\n  }\r\n\r\n  function set_body($val) {\r\n    $this->body = $val;\r\n  }\r\n\r\n  public function send() {\r\n    global $CONST;\r\n\r\n    if($this->mail_to == null) {\r\n      return false;\r\n    }\r\n    if($this->from == null) {\r\n      return false;\r\n    }\r\n\r\n    mb_language(\"japanese\");\r\n    mb_internal_encoding(\"UTF-8\");\r\n\r\n    $to = $this->mail_to;\r\n    $subject = $this->subject;\r\n    $body = $this->body;\r\n    if($this->from_name != null) {\r\n      $from_name = '=?UTF-8?B?' . base64_encode($this->from_name) . '?=';\r\n      $header = \"From: \" . $from_name . \"<\" . $this->from . \">\\n\";\r\n    }\r\n    else {\r\n      $header = \"From: \" . $this->from . \"\\n\";\r\n    }\r\n\r\n    $ret = mb_send_mail($to,$subject,$body,$header);\r\n\r\n    return $ret;\r\n  }\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u30b7\u30f3\u30d7\u30eb\u306a\u65e5\u672c\u8a9e\u30e1\u30fc\u30eb\u9001\u4fe1\u30af\u30e9\u30b9\u3067\u3059\u3002\u30b5\u30fc\u30d0\u30fc\u306e\u6587\u5b57\u30b3\u30fc\u30c9\u306fUTF-8\u3068\u3057\u305f\u5834\u5408\u3002 class mailsender { private $mail_to = null; private $from = null; pr &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/clouds.tokyo\/blog\/php_sendmail\/\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u3010PHP\u3011\u30b7\u30f3\u30d7\u30eb\u306b\u30e1\u30fc\u30eb\u9001\u4fe1&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":""},"categories":[2],"tags":[77,96],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pezW3u-3B","jetpack-related-posts":[{"id":844,"url":"https:\/\/clouds.tokyo\/blog\/php_sendmail_vn\/","url_meta":{"origin":223,"position":0},"title":"\u3010PHP\u3011\u65e5\u672c\u8a9e\u3067\u3082\u82f1\u8a9e\u3067\u3082\u306a\u3044\u8a00\u8a9e\u3067\u306e\u30e1\u30fc\u30eb\u9001\u4fe1","author":"yamamoto","date":"2017\u5e7411\u67086\u65e5","format":false,"excerpt":"\u65e5\u672c\u8a9e\u306e\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3068\u3057\u3066 mb_language(\"japanese\"); mb_i\u2026","rel":"","context":"\u5099\u5fd8\u9332","block_context":{"text":"\u5099\u5fd8\u9332","link":"https:\/\/clouds.tokyo\/blog\/category\/memo\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1681,"url":"https:\/\/clouds.tokyo\/blog\/mail_return_path\/","url_meta":{"origin":223,"position":1},"title":"\u3010PHP\u3011Return-Path\u672a\u6307\u5b9a\u3060\u3068\u8ff7\u60d1\u30e1\u30fc\u30eb\u6271\u3044\u306b\u306a\u308b\u30b1\u30fc\u30b9","author":"yamamoto","date":"2024\u5e746\u67086\u65e5","format":false,"excerpt":"\u6700\u8fd1\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304b\u3089\u306e\u4f9d\u983c\u3067\u3001Gmail\u5b9b\u3066\u306e\u30e1\u30fc\u30eb\u304c\u5c4a\u304b\u306a\u3044\u554f\u984c\u306e\u89e3\u6d88\u3068\u3044\u3046\u306e\u304c\u3042\u308a\u307e\u3057\u305f\u3002 \u8abf\u3079\u2026","rel":"","context":"\u5099\u5fd8\u9332","block_context":{"text":"\u5099\u5fd8\u9332","link":"https:\/\/clouds.tokyo\/blog\/category\/memo\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":263,"url":"https:\/\/clouds.tokyo\/blog\/js_null\/","url_meta":{"origin":223,"position":2},"title":"\u3010JavaScript\u3011NULL\u30a8\u30b9\u30b1\u30fc\u30d7","author":"yamamoto","date":"2006\u5e7410\u670810\u65e5","format":false,"excerpt":"\u3042\u308b\u3068\u91cd\u5b9d\u3059\u308bNULL\u30a8\u30b9\u30b1\u30fc\u30d7\u95a2\u6570 function nul(val, def) { if(def\u2026","rel":"","context":"\u5099\u5fd8\u9332","block_context":{"text":"\u5099\u5fd8\u9332","link":"https:\/\/clouds.tokyo\/blog\/category\/memo\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":469,"url":"https:\/\/clouds.tokyo\/blog\/js_val_type\/","url_meta":{"origin":223,"position":3},"title":"\u3010JavaScript\u3011\u5909\u6570\u306e\u30bf\u30a4\u30d7\u304c\u5408\u3063\u3066\u3044\u308b\u304b\u8abf\u3079\u308b","author":"yamamoto","date":"2007\u5e746\u670822\u65e5","format":false,"excerpt":"JavaScript\u306e\u5909\u6570\u306e\u30bf\u30a4\u30d7\u304c\u60f3\u5b9a\u901a\u308a\u304b\u3069\u3046\u304b\u3092true\/false\u3067\u8fd4\u3057\u307e\u3059\u3002 functi\u2026","rel":"","context":"\u5099\u5fd8\u9332","block_context":{"text":"\u5099\u5fd8\u9332","link":"https:\/\/clouds.tokyo\/blog\/category\/memo\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":679,"url":"https:\/\/clouds.tokyo\/blog\/js_length\/","url_meta":{"origin":223,"position":4},"title":"\u3010JavaScript\u3011\u9023\u60f3\u914d\u5217\u3067\u3082\u914d\u5217\u3067\u3082\u8981\u7d20\u6570\u3092\u53d6\u5f97","author":"yamamoto","date":"2017\u5e744\u670819\u65e5","format":false,"excerpt":"\u914d\u5217\u306e\u8981\u7d20\u6570\u306flength\u3067\u53d6\u5f97\u3067\u304d\u307e\u3059\u304c\u3001 \u9023\u60f3\u914d\u5217\u306e\u5834\u5408\u306flength\u306f\u4f7f\u3048\u307e\u305b\u3093\u3002 \u30b9\u30de\u30fc\u30c8\u3067\u2026","rel":"","context":"\u5099\u5fd8\u9332","block_context":{"text":"\u5099\u5fd8\u9332","link":"https:\/\/clouds.tokyo\/blog\/category\/memo\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":205,"url":"https:\/\/clouds.tokyo\/blog\/php_log_origin\/","url_meta":{"origin":223,"position":5},"title":"\u3010PHP\u3011\u72ec\u81ea\u306e\u30ed\u30b0\u3092\u51fa\u529b\u3057\u3088\u3046","author":"yamamoto","date":"2015\u5e746\u67088\u65e5","format":false,"excerpt":"\u958b\u767a\u306b\u30c7\u30d0\u30c3\u30b0\u30ed\u30b0\u3001\u30a8\u30e9\u30fc\u30ed\u30b0\u306f\u6b20\u304b\u305b\u307e\u305b\u3093\u304c\u3001 \u6a19\u6e96\u30ed\u30b0\u3084\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u30ed\u30b0\u3060\u3051\u3067\u306f\u60c5\u5831\u304c\u4e0d\u8db3\u3057\u2026","rel":"","context":"\u5099\u5fd8\u9332","block_context":{"text":"\u5099\u5fd8\u9332","link":"https:\/\/clouds.tokyo\/blog\/category\/memo\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/posts\/223"}],"collection":[{"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/comments?post=223"}],"version-history":[{"count":1,"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/posts\/223\/revisions"}],"predecessor-version":[{"id":224,"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/posts\/223\/revisions\/224"}],"wp:attachment":[{"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/media?parent=223"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/categories?post=223"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/tags?post=223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}