Sending mail with images - PHP

SpaceshipSpaceship
Spacemail by SpaceshipSpacemail by Spaceship
Namecheap AuctionsNamecheap Auctions
Watch

PoorDoggie

Soon to be RICHdoggie!VIP Member
Impact
18
I have a php script that sends an HTML email (using mail()) and for some reason the images don't show up. I have used standard HTML code:

HTML:
<img src="this.gif" alt="Some alt text" />

but for some reason it won't show up. The message just shows the "alt" text as normal text.

Is there something I have to do to show the images, a header perhaps?

Thanks
Tom
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
s'alright... I think I know what the problem is...

my image code is:

<img src="images/this.gif"> in an email I suppose you need <img src="http://mysite.com/images/this.gif"> - lol I am silly!
 
0
Close
lol great..mind telling me how u use HTML in php email form?

thts the code of my emailer

Code:
<?
/**************************************************    *************************
 *                           mail.php
 *                            -------------------
 *   Version              : 0.1
 *   email                : [email protected]
 * Warning:              Dont copy my source or fbi will kick ur ass
 **************************************************    *************************/

$name=$_POST['name'];
$email=$_POST['email'];
$subject=$_POST['subject'];
$comments=$_POST['comments'];
$id=$_POST['id'];
{
mail($id,$subject,$comments,"From: $email");
echo "Thanks for your comments.";
}
or die("There was a problem sending the mail. Please check that you filled in the form correctly.");

?>
 
0
Close
Please read:
http://www.php.net/manual/en/function.mail.php

Scroll down or here it is:

Example 4. Sending HTML email

It is also possible to send HTML email with mail().

<?php
// multiple recipients
$to = '[email protected]' . ', '; // note the comma
$to .= '[email protected]';

// subject
$subject = 'Birthday Reminders for August';

// message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';

// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "\r\n";
$headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);
?>

Copied from PHP manual.
 
0
Close
ah okay :D
Thanks for helping out
 
0
Close
Designporte said:
Copied from PHP manual.
:lol: I have that exact code, copied and pasted from the php site (except ZEND, not PHP.net... but I think they are the same company! :))
 
0
Close
unknowngiver said:
lol great..mind telling me how u use HTML in php email form?

thts the code of my emailer

Code:
<?
/**************************************************    *************************
 *                           mail.php
 *                            -------------------
 *   Version              : 0.1
 *   email                : [email protected]
 * Warning:              Dont copy my source or fbi will kick ur ass
 **************************************************    *************************/

$name=$_POST['name'];
$email=$_POST['email'];
$subject=$_POST['subject'];
$comments=$_POST['comments'];
$id=$_POST['id'];
{
mail($id,$subject,$comments,"From: $email");
echo "Thanks for your comments.";
}
or die("There was a problem sending the mail. Please check that you filled in the form correctly.");

?>



LOL @ FBI Will kick ur ass...

@Zubair : Any PHP Beginner can make a form mailer
 
0
Close
CatchedCatched

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back