views:

26

answers:

1

I am trying to imbed an image in my php emails and use as a signature. Meaning at the end of the email I want to have an image. I have tried many different combinations and for the most part am not getting the image to appear. Are there size restrictions for images or am I just doing in a way that is making it to heavy? A few things I have tried have not allowed the emails to even show up. Here is my code:

$to = $Email;
$subject = "$auth->first_name $auth->last_name left you a comment";
$message =  "$auth->first_name $auth->last_name left you a comment: <br /><br /> <a href='http://www.blah.org/Profile.php?id=" . $prof->id . "'>Click here to view</a><img src='http://www.blah.org/styles/images/blah.jpg'/&gt;";
$from = "blah<[email protected]>";
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: $from";
mail($to, $subject, $message, $headers);

I have also tried making an extension of $message like this:

.=$messages = "http://www.blah.com/styles/images/blah.jpg'/>";

Any suggestions for the most light weight and solid way to do this?

I have gotten the PHPMailer suggestion but would prefer to just add on to what I already have.

+1  A: 

I'd say use a class like PHPMailer. They have worked out all the details, and there is not that much room for better or worse efficiency when composing a rich E-Mail, so mails created with it will hardly be any bigger than if you encoded them yourself.

Pekka