2013-07-30 04:15
浏览 34


I'm making a Purchase Order system. All of our POs go out to our vendors via gmail SMTP server in PHP. I'm using Perl Mail for that.

Currently the reply-to is set to the from email, which is of course the gmail address. My goal, is to let vendors Reply To that PO email, and me grab that data and put it into my database.

I tried grabbing the IMAP Inbox via PHP and looking for the messages. But encrypted messages are unreadable, and I feel like it's hacky.

Is there a way, to make the reply-to email go back to my server, instead of gmail. And then have some light mail server running on my server to catch all email, or email with something in the from address (or subject) and then process the contents?


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dtdt0454
    dtdt0454 2013-07-30 13:46

    Thanks to Dragon for pointing me in the right direction.

    Add this to your /etc/aliases file (if you have postfix installed)

    process | "/path/to/php/script.php"

    Then run


    Then run

    /etc/init.d/postfix reload

    The PHP script looks like this

    $data = file_get_contents("php://stdin");
    $data = mysql_real_escape_string($data);
    mysql_query("INSERT INTO test SET thing = '$data'");
    点赞 评论