Jump to content

[SOLVED] Logo does not seem to work.


Klauwaart

Recommended Posts

Hello,

I have set up a PHP program to send emails to people who subscribe/unsubscribe to a newsletter.

Everything works fine except for one thing: I want to include a logo (a .jpg) to which I link via my site.

The code is this:

 

<HTML>
<HEAD>
<TITLE>Vlaanderen-Flanders</TITLE>
</HEAD>
<BODY>

<?php
// Always try to connect and select the DB before anything else
$con = mysql_connect("localhost","mrdee_mrdee","musical") or die("Couldnt Connect to DB - ".mysql_error());
mysql_select_db("mrdee_reloader", $con) or die("Couldnt Select a DB - ".mysql_error());

// Set post var
$Epost = trim(addslashes(strip_tags($_POST['Epost'])));

// Look for it in DB
$query = "SELECT Epost FROM newsletter WHERE Epost='".$Epost."'";
$result = mysql_query($query);

// If more than 0 rows are found, then we've found a match.. so check it
if (mysql_num_rows($result) > 0 )
{
    echo 'Email does not exist.';
}
else
{
    mysql_query("DELETE FROM newsletter WHERE Epost='$Epost'") or die(mysql_error());
}

mysql_close($con);
$email_address_to = "$Epost";
$foto = "http://www.vlaanderen-flanders.org.uk/Pics/Vlaamse Leeuw.jpg";
$stek = "http://www.vlaanderen-flanders.org.uk";
$subject = "Bedankt";
$message_contents = "Hello,\n you are now taken off our newsletter list.\n Should you change your mind, you are always welcome to subscribe again.\n Flemish regards,\n The webmaster.\n $stek\n sfoto";
$header = "From: webbie@vlaanderen-flanders.org.uk\r\n";
$header .= "Reply-To: webbie@vlaanderen-flanders.org.uk\r\n";
$header .= "webbie@vlaanderen-flanders.org.uk\r\n";
mail($email_address_to,$subject,$message_contents,$header);
?>
<div align="center"><img src="Pics/Vlaamse Leeuw.jpg" width="114" height="127" alt="" border="0" align=""></div>
<p align="center"><b>Thank you, you have now been taken off the list.</b></p><br>
<p align="center"><a href="index.htm"><img src="Pics/begin.gif" width="95" height="30" border="0"></a></p>
</BODY>
</HTML>

 

The only problem is: at the bottom, the email prints "$foto" rather than the expected actual picture.

It does print the URL ($stek variable) correctly however.

How can i solve this problem, please?

 

Thanks in advance.

 

 

Link to comment
Share on other sites

If you want to display an image in an email then you will need to send it as html.

 

Which means you have to include the content-type header so the receivers mail client knows that it contains html.

 

Something like:

<?php
$header .= "MIME-Version: 1.0\r\n"
  	    . "Content-Type: text/html; charset=\"iso-8859-1\"\r\n"
    . "Content-Transfer-Encoding: 7bit\r\n";
?>

And then use the html image tag

Link to comment
Share on other sites

The break in the link to your image is probably to do with the space in the filename, best to urlencode it, or not use spaces in your file names.

 

Sending html emails can be a right pain, mainly because you are at the mercy of whichever email company happens to be displaying the message, some allow some things, some don't.

 

Are you including your logo in a html tag?

 

I.e.

<img src="your_logo_file" alt="put_something_here" />

Is it just displaying the raw html or nothing?

 

Are you sure your email account will display html?

 

It is usually better to send a multipart message, which contains both a html and a plain text version, since your users will be using all different mail clients.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.