<?php
class Maskele{
var $Eposta = "";
var $DegisenEposta = "";
function Maskele($eposta){
$this->Eposta = $eposta;
}
function epostaMaskele(){
$yeniEposta = $this->Eposta;
$yeniEposta = str_replace("@"," at ",$yeniEposta);
$yeniEposta = str_replace("."," dot ",$yeniEposta);
$this->DegisenEposta = $yeniEposta;
}
function epostaCoz(){
$yeniEposta = $this->Eposta;
$yeniEposta = str_replace(" at ","@",$yeniEposta);
$yeniEposta = str_replace(" dot ",".",$yeniEposta);
$this->DegisenEposta = $yeniEposta;
}
function yazdir(){
echo '<a href="mailto:'.$this->Eposta.'">'.$this->DegisenEposta.'</a>';
}
function yonlendir(){
echo "<script>";
echo "location = 'mailto:" . $this->DegisenEposta . "';";
echo "</script>";
}
}
?>
Test 1
<?php
$e=new Maskele("ulusanyazilim@gmail.com");
$e->epostaMaskele();
$e->yazdir();
?>
Çıktısı
<a href="mailto:ulusanyazilim@gmail.com">ulusanyazilim at gmail dot com</a>
Test 2
<?php echo '<a href="?mail=ulusanyazilim at gmail dot com">Bu Adrese E-Posta Gönder</a>'; $e=new Maskele($_GET["mail"]); $e->epostaCoz(); $e->yonlendir(); ?>
Çıktısı
<script>location = 'mailto:ulusanyazilim@gmail.com';</script>
