CKEditor HTML to email

I have got CKEditor working okay and can save data to and from MYSQL.

What I want to do is get the HTML created and send this in an email so the content is the same as in the CKEditor.

I can get the HTML with

var dataInEditor = CKEDITOR.instances.Textarea1.getData();

Is this possible in javascript ?


Steve Warby

Got it working okay.


var dataInEditor = encodeURI(CKEDITOR.instances.Textarea1.getData());
req = Ajax("" + dataInEditor,quotesReturned);


function quotesReturned() {
 if (req.status == 200) { //success
      alert('data back from html'+ req.responseText);
       else {//'failure

      alert('error '+ req.err);


mail.php code

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');  

$to = '';
$from = '';
$body = rawurldecode($_GET["body"]);
$subject = 'DEAL NO';
echo 'HTML Recived = '.$body ;

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Create email headers
$headers .= 'From: '.$from."\r\n".
'Reply-To: '.$from."\r\n" .
'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $body, $headers);



Steve Warby

There’s always problems…

Php mail can only do so many lines.

Looking at PHPmailer

After a few hours of ‘f&*^ing around’ I realised I was using GET instead of POST and it was that that was cutting of the data.

The site is nearly there now using NSBasic & datatables with their Editor in the background to populate the deals. ( )

Work in progress


Steve Warby