Return to Snippet

Revision: 5440
at March 9, 2008 09:20 by gbot


Initial Code
<?php
function encode_mailto($mail, $label, $subject = "", $body = "") {
    $chars = preg_split("//", $mail, -1, PREG_SPLIT_NO_EMPTY);
    $new_mail = "<a href=\"mailto:";
    foreach ($chars as $val) {
        $new_mail .= "&#".ord($val).";";
    }
    $new_mail .= ($subject != "" && $body != "") ? "?subject=".$subject."&body=".$body : "";
    $new_mail .= "\">".$label."</a>";
    return $new_mail;
}
?>

Initial URL

                                

Initial Description

                                

Initial Title
encode mailto: link

Initial Tags
email, link

Initial Language
PHP