PHP Pre-Made Email Sender To Chosen E-Mail

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by dquigley, Jan 22, 2009.

  1. dquigley

    dquigley New Member

    Messages:
    249
    Likes Received:
    0
    Trophy Points:
    0
    I did

    PHP:
     $message 'Hello,

    A friend or colleague of yours, '
    .$_POST[sender_name].' , whose email address is '.$_POST[sender_email].' thought you may like to visit our site. 

    '
    .$_POST[name].' has used our Tell-a-Friend form to send you this email.

    http://www.dollarstoriches.com/?ref=$_SESSION['
    userid'] ';
    and got

    is there any info I havent provided that you need to help me with this?
     
  2. xPlozion

    xPlozion New Member

    Messages:
    868
    Likes Received:
    1
    Trophy Points:
    0
    change
    PHP:
     $message 'Hello,

    A friend or colleague of yours, '
    .$_POST[sender_name].' , whose email address is '.$_POST[sender_email].' thought you may like to visit our site. 

    '
    .$_POST[name].' has used our Tell-a-Friend form to send you this email.

    http://www.dollarstoriches.com/?ref=$_SESSION['
    userid'] ';
    to
    PHP:
     $message 'Hello,

    A friend or colleague of yours, '
    .$_POST[sender_name].' , whose email address is '.$_POST[sender_email].' thought you may like to visit our site. 

    '
    .$_POST[name].' has used our Tell-a-Friend form to send you this email.

    http://www.dollarstoriches.com/?ref='
    .$_SESSION['userid'];
    couple of things to note. when giving a variable a text value and using apostrophes to be it's delimiter, you have to escape the apostrophes that are in the text.

    PHP:
    // single quotes (apostophes)
    $var 'brr... it\'s cold outside'// correct
    $var 'brr... it's cold outside'; //'//incorrect (because it thinks you are ending the string.

    // quotes
    $var "the boy said, \"are you my father?\""// correct
    $var "the boy said, "are you my father?""// incorrect for the same reason

    //other notes
    $hi "hello world";
    $test['value'] = "test";
    $var "test, $hi{$test['value']}"// the point of what you can use when calling variables
    $var 'test, $hi'// will not work as expected, cause it will print exactly what's there. it won't show the strings value, but the name instead ;)

    PS. I'm getting ever so closer to 666 :lol:
     
    Last edited: Jan 23, 2009
  3. dquigley

    dquigley New Member

    Messages:
    249
    Likes Received:
    0
    Trophy Points:
    0
    HAHAHAH IT WORKED!! :D :D :D

    You sir are too cool for words : P
     
  4. xPlozion

    xPlozion New Member

    Messages:
    868
    Likes Received:
    1
    Trophy Points:
    0
    ty, some members aren't annoying and a pest, therefor i spend more time helping them out (like you and a few others) ;)

    some are clueless, and without that help would never find out what's wrong. I was in that position several years ago when i first started learning php... i've grown, and it's time to pass own my knowledge to others ;)
     
  5. dquigley

    dquigley New Member

    Messages:
    249
    Likes Received:
    0
    Trophy Points:
    0
    [​IMG]

    also, I was wondering, is there anyway to redirect them to a different page, instead of just saying all emails sent, It would be better that the user has a way to get back to the page, for the less computer literate ones.

    My ideal way of doing it is after sending, instead of redirecting to a different page, just show somewhere on the form "All emails sent"

    Or if that is too difficult

    Basically redirect the form back to itself after sending, that way the user doesnt get lost.
     
    Last edited: Jan 23, 2009
  6. xPlozion

    xPlozion New Member

    Messages:
    868
    Likes Received:
    1
    Trophy Points:
    0
    yea, that would be a simple html edit, no php required.

    replace
    PHP:
        echo 'All email\'s sent';
    with
    PHP:
    ?>
    All Email's Sent.<br /><br />
    <meta http-equiv="refresh" content="2;url=http://webdesign.about.com">
    <div style="text-align:center;"><a href="link to script">Click here to continue (or if you are not redirected in 2 seconds).</a></div>
    <?php
    i know it's not valid code, but it works in all browsers still. just replace the 2 urls in the example (meta and a href) with the url's you want to send them to :)
     
    Last edited: Jan 23, 2009
  7. dquigley

    dquigley New Member

    Messages:
    249
    Likes Received:
    0
    Trophy Points:
    0
    Man, its a good thing there is no charge for awesomeness or id be in debt to you for years, haha so in other words, it worked like a charm, and I am VERY happy!
     
    Last edited: Jan 23, 2009
  8. xPlozion

    xPlozion New Member

    Messages:
    868
    Likes Received:
    1
    Trophy Points:
    0
    np, as stated, just trying to help out. also doesn't help that i'm bored, other than the fact i'm playing grid :D

    as long as you're picking up some things, my job is done, otherwise you're not gaining any knowledge from it :frown:
     
  9. dquigley

    dquigley New Member

    Messages:
    249
    Likes Received:
    0
    Trophy Points:
    0
    Oh totally, not just knowledge but I can use this script as a template for future editing modifications and new scripts spawned from it. Also whats grid? You should check out moola, other then mmorpgs thats all I really play, you win money from it. I checked out your serene overload but gave up cause im using dsl here and it goes SOOOO slow, ill have to look at it at my fiances house, shes got comcast.
     

Share This Page