SitePoint Sponsor

User Tag List

Results 1 to 19 of 19
  1. #1
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question send and forward

    I have a feature which allows users to send a link to a friend - however I would also like to post the information they submit to myself but for some reason am not yet able. The form is in flash (actionscript 3.0) referencing a php file. Can anyone direct me?

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Well, I'm guessing that your script uses mail() right?

    Just change the $to to:
    PHP Code:
    'otherguy@theirhost.com, you@yourhost.com' 
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face

    I tried that but it's not sending to either now - here's what I have - perhaps you can kindly direct me from there.

    Code PHP:
    <?php
     
    // Create local PHP variables from the info the user gave in the Flash form -disabled message field
    $toName   = $_POST['toName'];
    $toEmail   = $_POST['toEmail'];
    $fromEmail = $_POST['fromEmail'];
     
    // Strip slashes on the Local variables -disabled message field
    $toName   = stripslashes($toName);
    $toEmail      = stripslashes($toEmail);
    $fromEmail   = stripslashes($fromEmail); 
     
        $to = $toEmail;
        $from = $fromEmail;
        $subject = "title";
        //Begin HTML Email Message
        $message = <<<EOF
    <html>
      <body bgcolor="#FFFFFF">
    <b>Hi $toName,<br />
    <b>            check this out !! <br />
    <b>			   <a href="http://website.com</a><br />
    <b>            <br />
      </body>
    </html>
    EOF;
       //end of message
        $headers  = "From: $from\r\n";
        $headers .= "Content-type: text/html\r\n";
        $to = "$to";
     
        mail(myaddress@host.com, $to, $subject, $message, $headers);
     
    exit();
    ?>

    I still want to send to the person they nominate as well as details to myself..

  4. #4
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php
    // Create local PHP variables from the info the user gave in the Flash form -disabled message field
    $toName $_POST['toName'];
    $toEmail $_POST['toEmail'];
    $fromEmail $_POST['fromEmail'];
    // Strip slashes on the Local variables -disabled message field
    $toName stripslashes($toName);
    $toEmail stripslashes($toEmail);
    $fromEmail stripslashes($fromEmail); 
    $subject 'title';
    //Begin HTML Email Message
    $message = <<<EOF
    <html>
      <body bgcolor="#FFFFFF">
    <b>Hi 
    {$toName},<br />
    <b>            check this out !! <br />
    <b>      <a href="http://website.com</a><br />
    <b>            <br />
      </body>
    </html>
    EOF;
    //end of message
    $headers  "From: {$fromEmail}\r\n";
    $headers .= "Content-type: text/html\r\n";
    $to "{$toEmail}, youraddress@host.com";
    mail($to$subject$message$headers);
    ?>
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  5. #5
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    awesome thanks

    - is there anyway to hide the address so the user can't see the forward address?

  6. #6
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yes, put it in a BCC Header instead, or send the mail twice - one for each address.

  7. #7
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the bcc method still displays it in the address bar of course.

    what's the simplest way of sending it twice? - is it just with the mail function?

  8. #8
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    No, that's CC.

    BCC won't show the other recipients.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  9. #9
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry - how exactly do I input that?

  10. #10
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    There comes to a point where I have to say this, and this is that point.

    Use the manual
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  11. #11
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    fair enough - haven't got a manual but thanks for the help anyway.

  12. #12
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  13. #13
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    at the risk of irritating everyone as well as myself I can't find any reference to this - I'm not looking for someone to do it for me .. .. just a push - I'm still learning as we all are

  14. #14
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    On the page I posted the url to, search for BCC.

    [hint]The third find is the one you're after[/hint]
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  15. #15
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if this is the one http://pear.php.net/bugs/bug.php?id=2476&edit=3

    then this is what I derived from that but now it comes into the inbox from my hosting account not the senders. Am I on the right lines here? I do appreciate this by the way.

    Code PHP:
        $headers  = "From: $from\r\n";
        $headers .= "Content-type: text/html\r\n";
        $headers['Bcc']= "myaddress@host.com";
        $to = "$toEmail";
     
        mail($to, $subject, $message, $headers);

  16. #16
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Because the headers are interpreted by the mailing server, it's fully string (no array).
    PHP Code:
    $headers  "From: $from\r\n";
        
    $headers .= "Content-type: text/html\r\n";
        
    $headers .= "Bcc: myaddress@host.com\r\n"
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  17. #17
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    superb - really appreciate that!

    you don't need to tell me how to do it but can you tell me if you think the following is possible:

    Of course the user can refer multiple people by using commas in the email section but I have a name section (as you might have seen in my code) which refers to the person in the message ($toName) and I was wondering if I could do so with each persons' name so that they just see their own name in the greeting. I hope that's clear - is it possible?

  18. #18
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    That would require multiple mails.

    To be honest, your name appearing in an email doesn't effect how you read it, and it doesn't make it feel more personal.

    So it might just be easier if you removed that, for efficiency reasons.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  19. #19
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    to be fair was thinking that but it's always interesting to try to learn something else - thanks for the help in this thread.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •