Ralph The Mouf
Ralph The Mouf

Reputation: 1007

Any knowledge on how to embed an image via PHPmail without using PHPMailer?

I would prefer to use what I already have and just add an image on if possible. Here is my code so far:

$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>";
$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);

Upvotes: 1

Views: 174

Answers (1)

Sampson
Sampson

Reputation: 268344

Place the HTML for the image in your $message.

$message = "Here is my image: <img src='http://www.mysite.com/1.jpg' />";

Be sure to use the absolute-url ("http://www.mysite...") as this will be loaded from recipient inbox's, and not from your server.

Upvotes: 1

Related Questions