douxiajia6309 2013-07-30 04:15
浏览 39
已采纳

电子邮件回复PHP脚本过程

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?

Thanks!

  • 写回答

1条回答 默认 最新

  • 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

    newaliases
    

    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'");
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 python:excel数据写入多个对应word文档
  • ¥60 全一数分解素因子和素数循环节位数
  • ¥15 ffmpeg如何安装到虚拟环境
  • ¥188 寻找能做王者评分提取的
  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图
  • ¥30 乘子法解约束最优化问题的matlab代码文件,最好有matlab代码文件
  • ¥15 写论文,需要数据支撑
  • ¥15 identifier of an instance of 类 was altered from xx to xx错误
  • ¥100 反编译微信小游戏求指导
  • ¥15 docker模式webrtc-streamer 无法播放公网rtsp