How to add line break in body for mailto

// PHP code

$email = 'myemail.domain.com';
$subject = addslashes("This is Subject: Let's check it...!!!");
$body = addslashes("This is message area. \r\n My Second line...Let's check it...!!!"); // body comes from text area so will have \r and \n
$body = str_replace(array("\r\n","\r","\n"),'%0D%0A',trim($body));

// HTML Code



<a onclick="mailto:<?=$email;?>?subject=<?=$subject;?>&body=<?=$body;?>" >Click here to email me</a>


Advertisements