Your mytextoverimage() function doesn't return anything - it just sends a jpeg image to the browser.
I've reworked your code to send the same image via email - note that just the image is sent, no HMTL.
If you want to send an image as part of an HTML document, you need to go a step further and create a multipart message - check out How to attach and show image in mail using php?
This works for Gmail on Iceweasel 10.0.11.
<?php
function mytextoverimage( $mytext )
{
$headurl = 'http://dummyimage.com/600x400/ffffee/00d5ff.jpg';
$jpg_image = imagecreatefromjpeg($headurl);
$black = imagecolorallocate($jpg_image, 1, 1, 1);
$font_path = 'myfont/arial.ttf';
$text = $mytext;
imagettftext($jpg_image, 24, 0, 175, 85, $black, $font_path, $text);
ob_start(); //Get the image data from the output buffer
imagejpeg($jpg_image);
imagedestroy($jpg_image);
return chunk_split(base64_encode(ob_get_clean())); //return the image data, encoded for email transfer
}
$to = "myemail@gmail.com";
$subject = "This is a image conversion from Developer Zone";
// --- Note the change from text/html to image/jpeg ---
$headers = "Content-type: image/jpeg;\r\n";
//$headers = "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= 'From: developer@phpdev.com' . "\r\n" .
'Reply-To: testabc@testabc.com' . "\r\n" .
'Content-Transfer-Encoding: base64' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$message = mytextoverimage('Developer');
mail($to,$subject,$message,$headers); die;