IMAP in Php: Marking a message unread/unseen

倖福魔咒の 提交于 2019-12-01 11:38:11

If I understand this page correctly:

http://www.php.net/manual/en/function.imap-body.php

You can use the FT_PEEK option to leave the message as 'unread'.

EDIT AFTER YOUR COMMENTS

Have you looked at this method?:

http://www.php.net/manual/en/function.imap-clearflag-full.php

You are able to clear the \\Seen flag.

Simply set a link like so

<a class"setunread" href="#">Set As Unread</a>

And link it to a click function to send ajax to server via .class"setunread".

<script type="text/javascript">
       $(document).ready(function() {

        $(function(){
            $('.setunread').click(function(){
                var message_status=<?php echo $messagecall['message_status'] ;?>;
                $.ajax({
                    type: "POST",
                  url: "updatemessages.php?message_status="+message_status,   
                    dataType:"json",  
                    success: function(datamessage) {
                    }
                });
                return false;
            });
        });
        });
        </script>

And then in Php you would connect to your database and set $_POST['message_status'] and make it secure in a variable when inserting it into the server $status=mysqli_real_escape_string($mysqli,$_POST['message_status']); setting the status back to 0 as unseen where seen is message_status=1. Obviously you would add more data into the server side code (Your PHP file) to select an individual message to set back to unseen but if your asking such a question, then I'd believe you to have some knowledge of how to build on this.

I know this is old, but it may well help somebody to be a bit clearer with such issues.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!