{"id":363,"date":"2010-09-06T23:10:17","date_gmt":"2010-09-06T14:10:17","guid":{"rendered":"http:\/\/flying-zebra.com\/blog\/?p=363"},"modified":"2011-07-13T18:33:35","modified_gmt":"2011-07-13T09:33:35","slug":"mail-forward","status":"publish","type":"post","link":"https:\/\/flying-zebra.com\/blog\/2010\/09\/mail-forward\/","title":{"rendered":"iPhone\u306e@i.softbank.jp\u3092Gmail\u306b\u8ee2\u9001"},"content":{"rendered":"<p>\u524d\u56de\u306b\u5f15\u304d\u7d9a\u304d\u30de\u30cb\u30a2\u30c3\u30af\u306a\u5185\u5bb9\u3067\u3059\u306e\u3067\u3001\u540c\u3058\u4e8b\u3092\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u4eba\u4ee5\u5916\u306f\u307e\u305a\u9762\u767d\u304f\u306a\u3044\u306e\u3067\u3055\u3063\u3055\u3068\u8aad\u307f\u98db\u3070\u3059\u3053\u3068\u3092\u304a\u52e7\u3081\u3057\u307e\u3059\u3002\u66f4\u306b\u3001\u81ea\u5206\u304c\u7ba1\u7406\u3057\u3066\u3044\u308b\u5e38\u6642\u7a3c\u50cd\u306e\u30b5\u30fc\u30d0\u30fc\u304c\u3042\u3063\u3066\u305d\u3053\u3067php\u3068cron\u304c\u4f7f\u3048\u308b\u3068\u3044\u3046\u7279\u6b8a\u306a\u74b0\u5883\u306e\u4eba\u4ee5\u5916\u306b\u306f\u5f79\u306b\u7acb\u305f\u306a\u3044\u60c5\u5831\u3067\u3059\u3002<br \/>\n\u305f\u308d\u7236\u306f\u65e5\u672c\u3067Gmail\u304c\u62db\u5f85\u306a\u3057\u3067\u3082\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u5f53\u521d\u304b\u3089Gmail\u3092\u30e1\u30a4\u30f3\u3067\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002\u30a2\u30c9\u30ec\u30b9\u306f@gmail.com\u306e\u30a2\u30c9\u30ec\u30b9\u3067\u306f\u306a\u304f\u3053\u306e\u30d6\u30ed\u30b0\u304c\u7f6e\u3044\u3066\u3042\u308b\u81ea\u5206\u306e\u30c9\u30e1\u30a4\u30f3\u306e\u3082\u306e\u3092\u5e38\u7528\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u30e1\u30fc\u30eb\u30c1\u30a7\u30c3\u30af\u3082\u9001\u4fe1\u3082\u5c02\u3089Gmail\u304b\u3089\u3067\u3001\u81ea\u5b85PC\u306e\u30e1\u30fc\u30e9\u30fc\u306f\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u7528\u306b\u6210\u308a\u4e0b\u304c\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3055\u3066\u3001\u4eca\u56de\u306fiPhone\u306e\u30e1\u30fc\u30eb\u3092Gmail\u3067\u6271\u3046\u65b9\u6cd5\u306e\u7d39\u4ecb\u3067\u3059\u3002\u5b9f\u306f\u3001\u9001\u4fe1\u30a2\u30c9\u30ec\u30b9\uff08From:\u30d5\u30a3\u30fc\u30eb\u30c9\uff09\u3092@gmail.com\u4ee5\u5916\u306b\u8a2d\u5b9a\u3059\u308b\u306e\u306f\u7c21\u5358\u3067\u3001@i.softbank.jp\u306e\u30e1\u30fc\u30eb\u3082\u4f8b\u5916\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u3053\u3053\u3067\u306f\u4e00\u6b69\u9032\u3093\u3067\u3001@i.softbank.jp\u3067\u53d7\u4fe1\u3057\u305f\u30e1\u30fc\u30eb\u3092\u81ea\u52d5\u7684\u306bGmail\u306b\u8ee2\u9001\u3057\u3066\u9001\u53d7\u4fe1\u30e1\u30fc\u30eb\u3092\u5168\u90e8Gmail\u3067\u7ba1\u7406\u3057\u3066\u3057\u307e\u304a\u3046\u3068\u3044\u3046\u308f\u3051\u3067\u3059\u3002\u4ee5\u4e0b\u306b\u7d39\u4ecb\u3059\u308b\u65b9\u6cd5\u3092\u4f7f\u3046\u306b\u306f\u3001php\u304c\u52d5\u304f\u30b5\u30fc\u30d0\u30fc\u304c\u4f7f\u3048\u3001\u66f4\u306bunix\u7cfb\u306ecron\u3084Windows\u7cfb\u306e\u30bf\u30b9\u30af\u30b9\u30b1\u30b8\u30e5\u30fc\u30e9\u30fc\u7b49\u3067\u5b9a\u671f\u7684\u306b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u8d70\u3089\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u3060\u3051\u30cf\u30fc\u30c9\u30eb\u3092\u4e0a\u3052\u3066\u304a\u3044\u3066\u51fa\u6765\u308b\u3053\u3068\u306f\u5927\u3057\u305f\u3053\u3068\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u81ea\u5206\u306e\u305f\u3081\u306e\u5099\u5fd8\u9332\u307f\u305f\u3044\u306a\u3082\u306e\u306a\u3093\u3067\u6c17\u306b\u3057\u306a\u3044\u3053\u3068\u306b\u3057\u307e\u3059\u3002<br \/>\nGmail\u306f\u4ed6\u306e\u30e1\u30fc\u30eb\u30b5\u30fc\u30d0\u30fc\u306e\u30e1\u30fc\u30eb\u3092POP\u3067\u8aad\u307f\u306b\u884c\u304f\u6a5f\u80fd\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u73fe\u5728\u306e\u3068\u3053\u308dIMAP\u306b\u306f\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u305b\u3093\u3002\u4e00\u65b9\u30bd\u30d5\u30c8\u30d0\u30f3\u30af\u306e@i.softbank.jp\u306e\u30e1\u30fc\u30eb\u30b5\u30fc\u30d0\u30fc\u306fIMAP\u306e\u307f\u3067\u3001POP\u3067\u306e\u30a2\u30af\u30bb\u30b9\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u305b\u3093\u3002\u5c06\u6765\u7684\u306bGmail\u304cIMAP\u3067\u306e\u30e1\u30fc\u30eb\u53d6\u5f97\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u304f\u308c\u308c\u3070\u4ee5\u4e0b\u306e\u65b9\u6cd5\u306f\u7121\u7528\u306e\u9577\u7269\u306b\u306a\u308a\u3001\u305d\u306e\u53ef\u80fd\u6027\u306f\u5341\u5206\u306b\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u5927\u96d1\u628a\u306b\u8aac\u660e\u3059\u308b\u3068\u3001IMAP\u3067\u30bd\u30d5\u30c8\u30d0\u30f3\u30af\u3001Gmail\u306e\u30b5\u30fc\u30d0\u30fc\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u305d\u308c\u305e\u308c\u306e\u30e1\u30fc\u30eb\u30dc\u30c3\u30af\u30b9\u3092\u958b\u304d\u3001\u30bd\u30d5\u30c8\u30d0\u30f3\u30af\u306e\u65b9\u306e\u30e1\u30fc\u30eb\u4e00\u89a7\u3092\u53d6\u5f97\u3057\u3066\u524d\u56de\u5b9f\u884c\u6642\u4ee5\u964d\u306b\u53d7\u4fe1\u3057\u305f\u30e1\u30fc\u30eb\u3092\u62bd\u51fa\u3057\u3001\u305d\u308c\u3089\u3092\u305d\u306e\u307e\u307eGmail\u306e\u30e1\u30fc\u30eb\u30dc\u30c3\u30af\u30b9\u306b\u30b3\u30d4\u30fc\u3059\u308b\u3068\u3044\u3046\u30b9\u30af\u30ea\u30d7\u30c8\u3092php\u3067\u8a18\u8ff0\u3057\u307e\u3059\u3002\u3053\u308c\u3092cron\u7b49\u3092\u4f7f\u3063\u3066\u5b9a\u671f\u7684\u306b\u52d5\u304b\u3059\u3068\u3044\u3046\u308f\u3051\u3067\u3059\u3002\u4ee5\u4e0b\u306b\u300130\u5206\uff081800\u79d2\uff09\u304a\u304d\u306b\u5b9f\u884c\u3059\u308b\u5834\u5408\u306e\u30b3\u30fc\u30c9\u3092\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre><code>\r\n&lt;?php\r\n\r\n$SRC = array(\r\n\u00a0'user' =&gt; 'your_user_ID',\r\n\u00a0'pass' =&gt; 'your_password',\r\n\u00a0'host' =&gt; 'imap.softbank.jp'\r\n);\r\n\r\n$DST = array(\r\n\u00a0'user' =&gt; 'your_mail_address',\r\n\u00a0'pass' =&gt; 'your_password',\r\n\u00a0'host' =&gt; 'imap.gmail.com'\r\n);\r\n\r\n$src = @imap_open(\"{\" . $SRC['host'] . \":993\/imap\/ssl\/novalidate-cert}INBOX\", $SRC['user']\r\n, $SRC['pass']) or exit(\"can't connect: \" . imap_last_error());\r\n$dst = @imap_open(\"{\" . $DST['host'] . \":993\/imap\/ssl\/novalidate-cert}INBOX\", $DST['user']\r\n, $DST['pass']) or exit(\"can't connect: \" . imap_last_error());\r\n\r\n$srcs = imap_check($src);\r\n$overview_list = imap_fetch_overview($src, \"1:{$srcs-&gt;Nmsgs}\", 0);\r\n\r\n$count = 0;\r\n$last = time() - 1800;\r\n\r\nforeach ($overview_list as $overview) {\r\n\u00a0\/\/ skip mails older than 1800 seconds\r\n\u00a0$time = strtotime($overview-&gt;date);\r\n\u00a0if ($time &lt; $last) { continue; }\r\n\r\n\u00a0$count++;\r\n\u00a0$head = imap_fetchheader($src, $overview-&gt;msgno);\r\n\u00a0$body = imap_body($src, $overview-&gt;msgno);\r\n\r\n\u00a0imap_append($dst, \"{\" . $DST['host'] . \":993\/imap\/ssl}INBOX\", $head.$body);\r\n}\r\n\r\nimap_close($src);\r\nimap_close($dst);\r\n\r\nheader(\"Content-Type: text\/html; charset=shift_jis\");\r\necho($count . ' messages copied');\r\n\r\nexit();\r\n\r\n?&gt;\r\n<\/code><\/pre>\n<p>\u3053\u308c\u3092\u9069\u5f53\u306a\u540d\u524d\uff08\u62e1\u5f35\u5b50.php\uff09\u3067\u4fdd\u5b58\u3057\u3001Web\u30b5\u30fc\u30d0\u30fc\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u305d\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308c\u3070\u3001\u51fa\u529b\u7d50\u679c\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002\u300c0 messages copied\u300d\u3068\u304b\u51fa\u3066\u304d\u305f\u3089\u6210\u529f\u3057\u3066\u3044\u308b\u3063\u307d\u3044\u3067\u3059\u3002\u30a8\u30e9\u30fc\u304c\u51fa\u3084\u3059\u3044\u306e\u306f@imap_open\u3042\u305f\u308a\u3067\u3001\u8a8d\u8a3c\u30a8\u30e9\u30fc\u3060\u3068\u30e1\u30fc\u30eb\u30b5\u30fc\u30d0\u30fc\u304c\u8fd4\u3057\u305f\u30a8\u30e9\u30fc\u3092\u300ccan&#8217;t connect:\u300d\u306b\u7d9a\u3051\u3066\u51fa\u529b\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002\u30e1\u30fc\u30eb\u30b5\u30fc\u30d3\u30b9\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u5c06\u6765\u5909\u66f4\u3055\u308c\u308b\u3053\u3068\u3082\u3042\u308b\u306e\u3067\u3001\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u3089\u305d\u306e\u90fd\u5ea6\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u8abf\u6574\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u3046\u307e\u304f\u52d5\u304f\u3088\u3046\u306b\u306a\u3063\u305f\u3089\u3001\u5f8c\u306fcron\u3067\u4e00\u5b9a\u6642\u9593\uff08\u3053\u306e\u4f8b\u3060\u306830\u5206\uff09\u6bce\u306b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u52d5\u304b\u3059\u3088\u3046\u8a2d\u5b9a\u3059\u308c\u3070\u5b8c\u6210\u3067\u3059\u3002\u30bd\u30d5\u30c8\u30d0\u30f3\u30af\u306e\u5951\u7d04\u3067iPhone\u3092\u4f7f\u3063\u3066\u3044\u3066\u3001Gmail\u3092\u30e1\u30a4\u30f3\u306b\u4f7f\u3063\u3066\u3044\u3066\u3001php\u3068cron\u304c\u52d5\u304f\u30b5\u30fc\u30d0\u30fc\u3092\u7ba1\u7406\u3057\u3066\u3044\u308b\u4eba\uff08\u3063\u3066\u3069\u3093\u3060\u3051\u3044\u308b\u3093\u3060\uff1f\uff09\u306f\u6d3b\u7528\u3057\u3066\u307f\u3066\u4e0b\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306b\u5f15\u304d\u7d9a\u304d\u30de\u30cb\u30a2\u30c3\u30af\u306a\u5185\u5bb9\u3067\u3059\u306e\u3067\u3001\u540c\u3058\u4e8b\u3092\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u4eba\u4ee5\u5916\u306f\u307e\u305a\u9762\u767d\u304f\u306a\u3044\u306e\u3067\u3055\u3063\u3055\u3068\u8aad\u307f\u98db\u3070\u3059\u3053\u3068\u3092\u304a\u52e7\u3081\u3057\u307e\u3059\u3002\u66f4\u306b\u3001\u81ea\u5206\u304c\u7ba1\u7406\u3057\u3066\u3044\u308b\u5e38\u6642\u7a3c\u50cd\u306e\u30b5\u30fc\u30d0\u30fc\u304c\u3042\u3063\u3066\u305d\u3053\u3067php\u3068cron\u304c\u4f7f\u3048\u308b\u3068\u3044\u3046\u7279\u6b8a\u306a\u2026 <span class=\"read-more\"><a href=\"https:\/\/flying-zebra.com\/blog\/2010\/09\/mail-forward\/\">\u7d9a\u304d\u3092\u8aad\u3080 &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,6],"tags":[],"class_list":["post-363","post","type-post","status-publish","format-standard","hentry","category-computer","category-mobile"],"_links":{"self":[{"href":"https:\/\/flying-zebra.com\/blog\/wp-json\/wp\/v2\/posts\/363","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/flying-zebra.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/flying-zebra.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/flying-zebra.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/flying-zebra.com\/blog\/wp-json\/wp\/v2\/comments?post=363"}],"version-history":[{"count":7,"href":"https:\/\/flying-zebra.com\/blog\/wp-json\/wp\/v2\/posts\/363\/revisions"}],"predecessor-version":[{"id":1535,"href":"https:\/\/flying-zebra.com\/blog\/wp-json\/wp\/v2\/posts\/363\/revisions\/1535"}],"wp:attachment":[{"href":"https:\/\/flying-zebra.com\/blog\/wp-json\/wp\/v2\/media?parent=363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/flying-zebra.com\/blog\/wp-json\/wp\/v2\/categories?post=363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/flying-zebra.com\/blog\/wp-json\/wp\/v2\/tags?post=363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}