www.webdeveloper.com
Results 1 to 4 of 4

Thread: emailing a link isn't working

Hybrid View

  1. #1
    Join Date
    Nov 2010
    Posts
    57

    emailing a link isn't working

    Hey,

    I'm trying to email some stuff that is retrieved from a form. Seems fairly simple and works fine... until I add in a link.
    In the form if I add
    Code:
    <a href="http://google.com">click me</a>
    in the email it shows up as blue text but it isn't underlined and it doesn't link.

    In my php I have the following:
    PHP Code:
    #convert line breaks into code line breaks
    $final_content str_replace("\r\n""\r\n<br>\r\n"$_REQUEST["main"]);

    $to $row['email'];
    $subject "email testing";
    $message_final "<html><body>Hi " $row['name'] . ", <br><br>This is an email with the content below from the forms.<br><br><i><font size='3'><b>" $_POST['heading'] . "</b></font><br><br>" $final_content "</i></body></html>";
                        
    $mailheader "From: mysite.com\r\n"
    $mailheader .= "Reply-To: someone@mysite.com\r\n"
    $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"
                        
    mail($to$subject$message_final$mailheader); 
    Any ideas as to why and or fixes?

    cheers,

    bob

  2. #2
    Join Date
    Nov 2010
    Posts
    57
    Ok I solved it by adding
    PHP Code:
    $final_content stripslashes($final_content); 
    unless this is bad for some reason (keeping in mind it doesn't have to be 100% secure for what I'm doing) then it's all solved

  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,537
    Sounds like you have the dreaded magic_quotes_gpc "feature" enabled. You might want to turn it off if possible, then not have to mess with the stripslashes(), or you can apply it to all input arrays as described in this article (though you would need to add a call to array_walk_recursive() for the $_REQUEST array, too, if you're going to use it (I never do).
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  4. #4
    Join Date
    Nov 2010
    Posts
    57
    haha yeah funnily enough you replied to another thread of mine with the same answer. Those damn magic quotes are killing me! I think for this it's not too bad to leave it as it's only one string and will probably only ever be one string. I might contact my host about turning it off but this will do for now.

    thanks (Y)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles