2
にメールを送信する私は電子メールパイプから呼び出されるスクリプトを持っています。 だから、誰かの電子メール[email protected]、それは電子メールをパイプして
#!/usr/bin/php -q
<?php
// read from stdin
$fd = fopen("php://stdin", "r");
$email = "";
while (!feof($fd)) {
$email .= fread($fd, 1024);
}
fclose($fd);
// handle email
$lines = explode("\n", $email);
// empty vars
$from = "";
$subject = "";
$headers = "";
$message = "";
$splittingheaders = true;
for ($i=0; $i < count($lines); $i++) {
if ($splittingheaders) {
// this is a header
$headers .= $lines[$i]."\n";
// look out for special headers
if (preg_match("/^Subject: (.*)/", $lines[$i], $matches)) {
$subject = $matches[1];
}
if (preg_match("/^From: (.*)/", $lines[$i], $matches)) {
$from = $matches[1];
}
} else {
// not a header, but message
$message .= $lines[$i]."\n";
}
if (trim($lines[$i])=="") {
// empty line, header section has ended
$splittingheaders = false;
}
}
?>
は、どのように私はそれが送られた電子メールを取得することができ、ここに行きますか?この場合、$ to = '[email protected]'が必要です。 しかし、 'abc'は何でもかまいません。そのため、ほとんどの場合、メールアドレスのユーザー名が必要です。
申し訳ありません申し訳ありませんが理にかなっていない、またはノービッシュです、私はこれに新しいです!
ありがとうございます。
ソースが "(envelope-from <[email protected]>)"と表示されているのは – willium
だけです。 "To:"ソースを見ると√ – willium