0

I am having trouble sending the image as it is..i have no trouble sending an email its just that the image is not displaying.. just the link..can you help me? here is my code..thanks in advance

require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();

$mail->IsSMTP(); // send via SMTP
$mail->Host="smtp.mail.yahoo.com"; // SMTP servers
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "*************"; // SMTP username
$mail->Password = "**********"; // SMTP password

$mail->From = "*********";
mail->FromName = "*****";
$mail->AddAddress(***********);

$mail->WordWrap = 50; // set word wrap

$mail->IsHTML(true); // send as HTML

$mail->Subject = "Welcome to LilShop";

$mail->Body = '<html>
<head>
</head>
<body>
<a href="http://localhost/mylilshoppev4/mylilshoppe/menu.php">
<img src="C:\phpwebsites\mylilshoppev4\mylilshoppe\images\images\lilshop.gif"alt="lilshop "  width="380" height="380" style="margin-left:1.5em;margin-top:1.5em;"/></a>
</body>
</html>';


$mail->Send();
Sammitch
  • 30,782
  • 7
  • 50
  • 77
Andre malupet
  • 91
  • 3
  • 12

3 Answers3

2

The image is using a local path. that file won't be available to anyone receiving the e-mail.

use http://localhost/mylilshoppev4/mylilshoppe/images/images/lilshop.gif

Rick Burgess
  • 704
  • 1
  • 5
  • 12
0

source must always be a URL for image , the image in your code will never display / upload in mail

Zaffar Saffee
  • 6,167
  • 5
  • 39
  • 77
0

As well as putting the file on an external website - imageshack, flickr, whatever - it is possible to include the content of the image in the email as an "attached file". If you want to do this, investigate mail attachments and mime64 encoding. You would still reference the file using a url, but it would be a relative one, i.e no http://example.com/ at the front.

Just a warning... if this is a site on the internet, make very sure you know that any value you read from the browser is what you expect it to be: preferably, don't read it from the browser at all but have it hard coded wherever possible.

Also, I would suggest ensuring that the php mail function cannot be invoked in any other context - e.g. by someone hoping that "http://example.com/email.php" will invoke it, even though there is no link referencing that file.

HtH

Ruth

rivimey
  • 921
  • 1
  • 7
  • 24