www.webdeveloper.com
Results 1 to 5 of 5

Thread: [RESOLVED] link inside php created mailto not working

  1. #1
    Join Date
    May 2009
    Posts
    237

    resolved [RESOLVED] link inside php created mailto not working

    I am creating a link to an amil button and inside the mailto content I want to add a link. But that is not working. I breaks the mailto link.

    PHP Code:
    $body ="
    Date Required: 
    $date%0A
    Contact: 
    $name[1] $name[0]%0A
    Requesting Lawyer: 
    $lawyername[1] $lawyername[0]%0A

    %0D%0A%0D%0A

    <a href=\"searchresults.php?id=
    $id\">View Full Details</a>
    "
    ;

    echo 
    '
    <p class="head">Your request has been submitted.</p>
    <p class="subhead">You must confirm your Search by email.<br />Please, click on the button below to send the email.</p>
    <br /><br />

    <a href="mailto: email@email.com?subject=Corporate Search Request&body='
    .$body.'" /><img src="images/email-order.jpg" width="113" height="29" border="0" /></a>
    '
    ;
    }
    ?> 
    This is what appears:

    View Full Details" " />[graphic]

    error.gif
    Attached Images Attached Images

  2. #2
    Join Date
    Feb 2013
    Posts
    2
    Looks like you just need to urlencode() that <a> tag in your $body variable:

    PHP Code:
    $body =
    Date Required: 
    $date%0A 
    Contact: 
    $name[1] $name[0]%0A 
    Requesting Lawyer: 
    $lawyername[1] $lawyername[0]%0A 

    %0D%0A%0D%0A 

    "
    ;
    $body .= urlencode(<a href=\"searchresults.php?id=$id\">View Full Details</a>); 

  3. #3
    Join Date
    May 2009
    Posts
    237
    Did not quite work - it show the page correctly with the graphic as the link now but in the email I get this

    <a+href="http://litsupport.myfasken.com/searches/searchresults.php?id=$id">View+Full+Details</a>

  4. #4
    Join Date
    May 2009
    Posts
    237
    I have tried this

    $body .= rawurlencode("<a href=\"http://litsupport.myfasken.com/searches/searchresults.php?id=$id\">View Full Details</a>");

    but I still get this:

    <a href="http://litsupport.myfasken.com/searches/searchresults.php?id=1">View Full Details</a>

    but it is not html ie I should only see View Full Details

  5. #5
    Join Date
    Feb 2013
    Posts
    2
    Bad news, I'm afraid: http://tools.ietf.org/html/rfc2368

    Looks like the specification states that the body parameter is supposed to be text/plain only, with no allowances for HTML tags. An alternative option that you can explore would be to print the URL itself into the email in plain text, without the image. Most modern email clients will automatically turn a well-formed URL into a clickable link.

Thread Information

Users Browsing this Thread

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

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