Problem sending mail with .php - Error with <IMG

I am trying to send an .html email with .php and i get error if i use IMG, Look at my attached code below and tell me what i am doing wrong.

Thank you
<?
session_start();
$batch = 1; //<== Put the number of addresses to which you want to send at one time here
$wait = 1; //<== Put the number of seconds to wait between batches here
$file = 'Emails.txt'; //<== Put the real path to the Emails.txt file here
$addresses = file($file);
print_r($addresses);
$num = count($addresses);
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: xxl! <no-reply@xx>' . "\r\n";
$subj = "lalala" ;
$msg = "<html>
<head>
<BODY>
<IMG src="http://www.xxx.com/logo_tagline_small.gif" id=IMG1></BODY></HTML>";
$i = 1;
$to = ''; //<== initialize an empty $to
 
while ($i <= $num) {
echo "<p>$i</p>\n";
 
            if(!empty($addresses[$i])) $to .= rtrim($addresses[$i]) . ", ";
           
            if($i % $batch == 0){ //If the $i is equally divisible by $batch, it's time to send the mail and sleep
                  $to = substr($to,0,strlen($to)-2); //Strip off the trailing comma and space
              if(mail($to, $subj, $msg, $headers)){
echo "<p>Sent mail to $to.</p>\n";
}else{
echo "<p>Failure sending mail to $to.</p>\n";
}
 
              sleep($wait); //tell the script to wait before continuing
              $to = ''; //reset $to, starts address list over, doesn't mail people twice
        } // end if
       
        $i++; //increment $i to get the next address from the array
       
} // end while
header("Location: emails_send.html");
?>

Open in new window

KingSencatAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

quincydudeCommented:
change

$msg = "<html>
<head>
<BODY>
<IMG src="http://www.xxx.com/logo_tagline_small.gif" id=IMG1></BODY></HTML>";

to



$msg = <<<HTMLCONTENT
<HTML>
<HEAD>
</HEAD>
<BODY>
<IMG src="http://www.xxx.com/logo_tagline_small.gif" id="IMG1"></BODY></HTML>
HTMLCONTENT;

Open in new window

0
aherpsCommented:
You need to comment out your quotations:



<IMG src=\"http://www.xxx.com/logo_tagline_small.gif\" id=IMG1></BODY></HTML>";

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Loganathan NatarajanLAMP DeveloperCommented:
you also try with single quote

$msg = "<html>
<head>
<BODY>
<IMG src='http://www.xxx.com/logo_tagline_small.gif' id='IMG1'/></BODY></HTML>";

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.