How do I add an image to this code

<? // initial facility for verification include_once 'captcha/captcha.php'; $c = new captcha(); if (empty($_POST)) { print "Error with form, please contact the webmaster."; } else if (!$c->isValid()) { include_once 'wrong.htm'; } else { // Configuration Settings $SendFrom = "{$_POST['Name']} <{$_POST['email']}>"; $SendTo = " , [email protected] , <{$_POST['email']}> "; $SubjectLine = "No reply @ mysite"; $ThanksURL = "thankyou.htm"; //confirmation page $Divider = "Thank you for submitting your details we will be in contact with you soon please DO NOT reply to this e-mail as it has been automatically generated. For any Correspondence please use the following E-mail address [email protected] "; $message = "Thanks etc"; // Build Message Body from Web Form Input $MsgBody = @gethostbyaddr($REMOTE_ADDR) . "\n$Divider\n"; foreach ($_POST as $Field=>$Value) $MsgBody .= "$Field: $Value\n"; $MsgBody .= $Divider . "\n" . $HTTP_USER_AGENT . "\n"; $MsgBody = htmlspecialchars($MsgBody); //make content safe // Send E-Mail and Direct Browser to Confirmation Page mail($SendTo, $SubjectLine, $MsgBody, "From: " . $SendFrom); header("Location: $ThanksURL"); } ?>

If you want to have image in email body - you just need to specify in email headers Content-type: text/html; and add regular image tag .
But if you need to attach image to message I would suggest you to use PHPMailer class - it allows to send files as attachment easily. There are samples of usage this class included in zip, and it is free to use.

Sponsor our Newsletter | Privacy Policy | Terms of Service