943,769 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1806
  • PHP RSS
Jan 15th, 2008
0

Need help NEWSLETTER

Expand Post »
Please need help I have an code for send a newsletter by the help of a good friend, but when I tried looks fine and when I open the email I received contain the newsletter picture are not appeared all necessary image are also uploaded in the same folder.

PHP CODE:

<?php

$file = 'newsletter.html';
$open = fopen($file, 'r');
$read = fread($open, filesize($file));
fclose($open);
$message =<<<MES
$read
MES;

$from = 'sender';

$subject = 'Newsletter';
$headers = "From: $from\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$hostname='h41mysql59.secureserver.net';
$username='qwertyuiop';
$password='*****';
$dbname='qwertyuiop';
$usertable='email';
$yourfield = 'email';

$con = mysql_connect("$hostname","$username","$password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}


$database = mysql_select_db('qwertyuiop', $con);
if (!$database) {
echo "DATABASE COULDN'T BE SELECTED";
}
$sql = "SELECT * FROM email";
$query = mysql_query($sql);
while ($row = mysql_fetch_assoc($query)) {
$to = $row['email'];
$mail = mail($to, $subject, $message, $headers);
}
if ($mail) {
echo 'All (' . mysql_num_rows($query) . ') Messages sent successfully';
}
mysql_close($con);
?>

NEWSLETTER HTML CODE

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>sample</title>
<style type="text/css">
<!--
body {
background-color: #000066;
}
.style1 {
color: #FFFFFF;
font-size: xx-large;
}
.style2 {
font-size: 12px;
color: #CCCCCC;
}
-->
</style></head>

<body>
<table width="596" height="248" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th scope="row"><p class="style1">Sample</p>
<p class="style1">&nbsp;</p>
</th>
</tr>
</table>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th background="images/newsletter_01.gif" scope="row"><p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp; </p></th>
</tr>
</table>
</body>
</html>
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Cente is offline Offline
16 posts
since Oct 2007
Jan 15th, 2008
0

Re: Need help NEWSLETTER

If I understand correctly...

The php script works fine and you received the newsletter.
The newsletter is formatted properly with the HTML.

The problem is that the pictures aren't appearing when you read the newsletter in your e-mail.

If that's the case, then you're problem may be in the way you specify the source for your images. In the HTML, you've got a reference to one image as: "images/newsletter_01.gif"

This type of relative URL won't work in an e-mail. The browser is looking for the file "images/newsletter_01.gif" inside the folder that the e-mail script is executing.

If you replace all of your relative URLs for images with absolute URLs (i.e. "http://www.mydomain.com/images/newsletter_01.gif"), they should appear correctly.

If that's not the problem, also make sure that your e-mail reader isn't blocking the images. I know that gmail blocks images by default. Some other web-based e-mail readers probably do the same thing.

Good luck,
- Walkere
Reputation Points: 29
Solved Threads: 5
Junior Poster in Training
Walkere is offline Offline
57 posts
since Jan 2008
Jan 16th, 2008
0

Re: Need help NEWSLETTER

Thank you so much Walkere your right I need to emphasize properly the exact location of the image I attached, just follow up question I tried to insert an flash file *.SWF did not show at all even I clearly declared the exact location of the file.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Cente is offline Offline
16 posts
since Oct 2007
Jan 16th, 2008
0

Re: Need help NEWSLETTER

You should embed your flash file in your html page.
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Jan 16th, 2008
0

Re: Need help NEWSLETTER

Click to Expand / Collapse  Quote originally posted by nav33n ...
You should embed your flash file in your html page.
Thank you Nav33n I'll try to do that.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Cente is offline Offline
16 posts
since Oct 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: help
Next Thread in PHP Forum Timeline: Replacing 2 characters with with preg_replace





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC