Link to home
Start Free TrialLog in
Avatar of zollgut
zollgut

asked on

PHP image in email

Hi, can anyone tell me if there's a quick and simple way to add an image to my php mail script which displays the image on the email received?

Thanks!
Avatar of Rurne
Rurne
Flag of United States of America image

If it's an HTML email, then you can just link it in the HTML.  If not, then you will have to add it as an attachment.  Depending on your mail code, this can be easy, or it can mean having to base64_encode the image and hacking out your own multipart/mixed sections.

What's your current email code look like?
Avatar of zollgut
zollgut

ASKER

Hi, Thanks for your help Rurne

Its using php, i've tried using a simple link but this obviously didnt work :D

A sample of the code used below:

$from3 = "email@domain.com";
$to3 = Trim(stripslashes($_POST['email']));
$subject3 = "Booking Confirmation";
 
$body3 = "";
$body3 = '<img src="http://www.domain.com/logo.jpg" />';
$body3 .= " ";
$body3 .= "\n";
$body3 .= "\n";
$body3 .= "Number of Delegates :";
$body3 .= " ";
$body3 .= $delegatenum;
$body3 .= "\n";
$body3 .= "\n";
$body3 .= "Your booking has been confirmed. Thank you.";
$body3 .= "\n";
$body3 .= "\n";
 
 
$success3 = mail($to3, $subject3, $body3, "From: <$from3>");

Open in new window

Avatar of zollgut

ASKER

Can anyone help with the code above? thanks
ASKER CERTIFIED SOLUTION
Avatar of Rurne
Rurne
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial