[SUGGESTION] Email Message Descriptions

Discussion in 'The Suggestion Box' started by EmoryCrafts, May 14, 2015.

?

Should this be implemented?

Yes 5 vote(s) 83.3%
Yes, with some modifications 1 vote(s) 16.7%
No 0 vote(s) 0.0%
  1. Hey Empire!

    I've been getting lots of Empire Email Notifications lately, and it's kinda annoying to have to click on it and open the links. Especially if I'm at school :p

    If this has been suggested, Staff can delete this thread if they want.
    Otherwise, I would like to suggest an email preview.

    Basically, when someone sends or replies to your private message, or quotes or responds to a thread you are email-watching (you turn on "watch thread- get email notifications"), it will send you an email, like before, but it will say "[username]
  2. Good idea! +1
  3. This is actually very easy to do already, all you need to do is use ajax, jquery, and php

    this isn't the full code, just a gist

    ajax within jquery
    Code:
    <script type="text/javascript">
    $(document).ready(function(){
    
    $("#reply").submit(function (e){
    var message = $("#tinymce").val();
    var picture = "get the quick reply user's image url"
    var subject = "get user sending message and the thread title"
    var user = "get the person that sent the message's name"
    
    $.post('http://empireminecraft.com/db/mail.php',{'username':user, 'picture':picture, 'message':message, 'subject':subject}, function(data){
    //you can add a success system here if you want, not necessary
    });
    });
    });
    </script>
    
    php end
    Code:
    <?php
    $rUser = $_POST['username'];
    $rUserEmail = $_POST['email'];//don't use post, do a database lookup based on the username instead
    $rUserMessage = $_POST['subject'];
    $SendPic = $_POST['picture'];
    $SendMessage = $_POST['message'];
    
    $to = "$rUser <$rUserEmail>";
    $subject = '$rUserMessage: ' . $rUser;
    $message = "
    <html>
    <head>
    <style>
    body{
    color:white;
    background-color:gray;
    }
    a{
    color:lime;
    }
    p{
    text-align:center;
    }
    h1{
    text-align:center;
    }
    </style>
    </head>
    <body>
    <h1><span><img height=\"24px\" width=\"24px\" src=\"http://empireminecraft.com/static/emcicon.png\"></img></span>Empire Minecraft<span><img height=\"24px\" width=\"24px\" src=\"http://empireminecraft.com/static/emcicon.png\"></img></span></h1>
    <img height=\"24\" width=\"24px\" src=\"$SendPic\"></img><span>$SendMessage</span>
    </body>
    </html>
    ";
    
    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
    $headers .= "From: Empire Minecraft <alerts@empireminecraft.com>" . "\r\n";
    
    mail($to,$subject,$message,$headers);
    ?>
    
  4. Wow.
    Go tell Aikar now. :p
  5. You can turn off the emails if you want.
  6. This will be enabled by default after forum upgrade.
    sambish20 and EmoryCrafts like this.