Send e-mail to a user only

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Send e-mail to a user only

    Here is a simple script that can send e-mail to registered users in your site (for example to one of your friends) if they have email, of course.

    I called it mail-to-friend.php but you can change it and table structures to match with your lavalair/wapdesire site, for example.

    -----

    $what = $GET_['what'];

    if ($what == "") {

    $user = $_GET['user'];

    echo "Send email to $receiver<br/>";
    echo "It will be sent on $user\"s email inbox.<br/><br/>";

    echo "<form action='?what=sendemailnow' method='post'>";
    echo "<input type='hidden' name='user' value='$user'>";
    echo "Subject:<br/><input name='subject' maxlength='30' /><br/>";
    echo "Message:<br/><textarea name='message'></textarea><br/>";
    echo "<input type='submit' value='Send'/></form>";
    echo "</center>";

    }

    else if($what=="sendemailnow"){

    $time = time();
    $whenlastmail = mysql_fetch_array(mysql_query("SELECT lastmailtime FROM ibwf_mailcare"));
    $checkit = $whenlastmail[0] + 30;

    if ($time <= $checkit)
    {
    echo "Server is too busy. Please try again.<br/>";
    exit();
    }

    mysql_query("UPDATE ibwf_mailcare SET lastmailtime='".$time."'");

    $user = $_POST['user'];
    $sender = myname($session);
    $subject = $_POST['subject'];
    $message = $_POST['message'];
    $title = $_POST['title'];

    $email = mysql_fetch_array(mysql_query("SELECT email FROM members WHERE user='".$user."' "));

    $msg = "$message";
    $msg .= "\n\n";
    $msg .= "This e-mail has been sent by $sender (member of Virtual City).\n";
    $msg .= "To answer, login to Virtual City by using your name and password.\n\n";
    $msg .= "www.vcity.us.to\n";
    $subject = "".$title."";
    $headers = "From: noreply@vcity.us.to";

    $senditnow = mail($email[0], $subject, $msg, $headers );

    if ($senditnow) { echo "Message sent to $receiver."; }
    else { echo "Message could not be sent to $receiver."; }

    }

    -----

    and this one is to add in the users profile:

    $email = mysql_fetch_array(mysql_query("SELECT email FROM members WHERE user='".$user."' "));
    if ($email[0] == "")
    {
    $mail = "Send e-mail";
    }
    else
    {
    $mail = "<a href='mail-to-friend.php?session=$session&user=$user'>Send e-mail</a>";
    }
    echo "$mail</br>";

    -----

    if you dont know how to make it for your site, ask for help here, me or others will help.
    Last edited by Mysterio; 19.11.09, 13:42.
    mysterio.al - programming is a functional art

    #2
    i like this but think theres a spamming problem. as ppl will just email ppl other sites very easily instead of using pms that can be auto detected for spam .
    am i right ??
    Wapchat4u


    Topsites4u

    Comment


      #3
      im using this, and yahoo did not tell that the mail is spam
      Did I help you?
      You can help me too
      Your donations will help me finance my studies.

      Comment


        #4
        u dont get wot i mean lol .if a users joins to spam ya site so that all your users join there own site. isnt that a way of it goin undetected. like me sending you an email now and asking you to join my site. . .someone could target all your users and no one would no . .
        Wapchat4u


        Topsites4u

        Comment


          #5
          if you have 300 emails into database and you want to deliver to all the script will overload the server.
          the best way to send is to deliver 5-6 emails per min and for this you must reconsider the script.
          define a new row with this condition.for this see my previous posts about spam message sender.
          anyway you must put some headers and server signatures to be received as trust email and you must delete hidden input from form;if you have some data to send from formular to other php files insert into session by user.
          some ppl may use as spam. insert time as trigger.
          Last edited by blackhowk; 18.11.09, 21:44.
          http://ngeo.ro

          Comment


            #6
            it sends email only to one user, not to all users a time. and yes, blakhowk, must make only for one mail in minute.
            Last edited by Mysterio; 18.11.09, 21:38. Reason: i edited the name from blackhawk to blackhowk, lol
            mysterio.al - programming is a functional art

            Comment


              #7
              this is more difficult because we dnt know what is: newsletter?info?tell a friend?
              first you must define the message as well.second you need to have confirmation of each registered user with terms and AGREE to receive emails.
              in some country spam terms are hard to manage.
              http://ngeo.ro

              Comment


                #8
                Originally posted by blackhowk View Post
                this is more difficult because we dnt know what is: newsletter?info?tell a friend?
                first you must define the message as well.second you need to have confirmation of each registered user with terms and AGREE to receive emails.
                in some country spam terms are hard to manage.
                come on, it was more like an idea...
                the confirmation can be done very easy
                mysterio.al - programming is a functional art

                Comment


                  #9
                  So that is the exact thing to do about the file
                  http://myfacepals.com
                  MYFACEPALS SOCIAL NETWORKsigpic

                  Comment


                    #10
                    rather then provide that option to every user only owner or site admin should have this who could send a bulk mail to all users such as news letter/ new updates etc (must sent few users once might add time as blackhowk said) and why you providing this Feature to users ? when you have internal mailbox system or pop up system ? its just option for spammers else if you wana this then include from spam filter tool or file which can filter spam Messages

                    more things can add such as

                    send bulk mail only staff members

                    send bulk mail only banned members

                    send bulk mail to all users
                    Last edited by GiLL; 19.11.09, 13:07.
                    left wap stuff

                    Comment


                      #11
                      lol Gill, why you talk like you are obligated to do that in your site? Why not correct anything on it and bring it here?
                      mysterio.al - programming is a functional art

                      Comment


                        #12
                        Originally posted by Mysterio3 View Post
                        lol Gill, why you talk like you are obligated to do that in your site? Why not correct anything on it and bring it here?
                        does it make sense ? do u have any problem what ever i do at my site?and what did i say wrong ? its forum anyone can post and give a suggestion its up to you like or dont like it read my post before write any bloody things
                        left wap stuff

                        Comment


                          #13
                          Ok, I edited the script. It just sends one mail / 30 seconds.
                          Create in your database a table called ibwf_mailcare with a field lastmailtime and put there a value (1 for example).

                          Lol Gill, why you so nervous? Its not I dont like your post, but your mission is just to find mistakes everywhere. Its better to help each-other, than anouncing ourselves like best coders. And one more thing Gill: don't try to irony my posts by profiting I am pro peace.
                          mysterio.al - programming is a functional art

                          Comment


                            #14
                            i dont care man lol do what ever you like at your site and find mistakes everywhere? is it bad habit ?its also help to improve security and suggest update new things you wrote as i didnt say your code wrong or anything i am not nervous lol and do you like people come at your site and open your users profile online / offline send them their site link to join ? and you will loose all user one day even you will not come to know where gone and who invited your user and seccond i also gave you a suggestion for you to use filter system i dont know what was wrong in my post next time i wont reply in your topic enjoy
                            left wap stuff

                            Comment


                              #15
                              Originally posted by GiLL View Post
                              i dont care man lol do what ever you like at your site and find mistakes everywhere? is it bad habit ?its also help to improve security and suggest update new things you wrote as i didnt say your code wrong or anything i am not nervous lol and do you like people come at your site and open your users profile online / offline send them their site link to join ? and you will loose all user one day even you will not come to know where gone and who invited your user and seccond i also gave you a suggestion for you to use filter system i dont know what was wrong in my post next time i wont reply in your topic enjoy
                              Come on bro', why should you be so serious? I just wanted to say you that better help somehow than just criticize. Ok, sorry for what I was wrong but no need to fight. I love Coding-Talk and all users here. When I entered here I was at zero. So, I am here not to teach others, but to talk with others. Peace!
                              mysterio.al - programming is a functional art

                              Comment

                              Working...
                              X