Jump to content


Photo

Need help with mail() problems


  • Please log in to reply
4 replies to this topic

#1 mazman13

mazman13
  • Members
  • PipPipPip
  • Advanced Member
  • 156 posts

Posted 15 September 2006 - 10:17 PM

I have a mailing list set up that will send a message to everyone in my database.

But when it comes back with HUGE spaces...its prob somthin' simple, but I guess I'm missin it.

Here is my code:
if($action == "send")
{

$query = "SELECT * FROM $db";
$result = mysql_query($query)
or die ("Can't do anything with the query!");
$num = mysql_num_rows($result);



$i=0;
while ($i < $num) {
$row = mysql_fetch_array($result,MYSQL_ASSOC);
extract($row);
$e_message = stripslashes($e_message);
$e_message = nl2br($e_message);
$e_subject = stripslashes($e_subject);
//Sends them the letter
$to = "$ml_email";
$subj = "$e_subject";
$mess = "
<html>
<h2><b>$e_header</b></h2><p>

$e_message<p>

<font color='#666666' size='1' face='Tahoma, Times New Roman'>the michael zavala show is &copy 2006 by michael zavala<strong><br />
<a href='http://www.themichaelzavalashow.com'>www.themichaelzavalashow.com</a> | <a href='http://www.myspace.com/themichaelzavalashow'>www.myspace.com/themichaelzavalshow</a></strong></font><br />
<br /><strong><font color='#666666' size='1' face='Tahoma, Times New Roman'>please do not respond to this e-mail.<br />
</font></strong><font color='#666666' size='1' face='Tahoma, Times New Roman'>if you wish to stop receiving e-mails from the michael zavala show, please <a href='http://www.michaelza...email=$ml_email' target='_blank'>unsubscribe</a>.</font><p>

<a href='http://click.linksynergy.com/fs-bin/click?id=tOWLWDAF1Yk&offerid=78941.10001365&type=4&subid=0'><IMG alt='Apple iTunes' border='0' src='http://images.apple.com/itunesaffiliates/US/2006/09/05/MaryJBlige_468x60.jpg'></a><IMG border='0' width='1' height='1' src='http://ad.linksynergy.com/fs-bin/show?id=tOWLWDAF1Yk&bids=78941.10001365&type=4&subid=0'>

</html>";
mail($to, $subj, $mess, "From: The Michael Zavala Show <show@themichaelzavalashow.com>\n" .
    "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1");
$i++;
}
echo("<b>E-mail's have been sent.</b><br />");
};

the output looks great...but the spaces:

"more...







thanks



michael"

I guess it's adding more <br>s??
Any ideas?

#2 markbett

markbett
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 15 September 2006 - 11:50 PM

ok put your code in code tags so we can tell what is what... did you post the actual text of the message that is sent??

#3 mazman13

mazman13
  • Members
  • PipPipPip
  • Advanced Member
  • 156 posts

Posted 16 September 2006 - 04:28 AM

Here is my code:

//If a message is sent
if($action == "send")
  {
 
      $query = "SELECT * FROM $db";
  $result = mysql_query($query)
      or die ("Can't do anything with the query!");
  $num = mysql_num_rows($result);



      $i=0;
while ($i < $num) {
  $row = mysql_fetch_array($result,MYSQL_ASSOC); //starts to get e-mails from the database
      extract($row);


$e_message = stripslashes($e_message); //converts the subject and message strings
$e_message = nl2br($e_message);
$e_subject = stripslashes($e_subject);


sends the e-mails:       
//Sends them the letter
        $to = "$ml_email";
        $subj = "$e_subject";
        $mess = "
        <html>
        <h2>$e_header</h2><p>
       
        $e_message<p>
       
        <font color='#666666' size='1' face='Tahoma, Times New Roman'>the michael zavala show is &copy 2006 by michael zavala<strong>

          <a href='http://www.themichaelzavalashow.com'>www.themichaelzavalashow.com[/url] | <a href='http://www.myspace.com/themichaelzavalashow'>www.myspace.com/themichaelzavalshow[/url]</strong></font>

         
<strong><font color='#666666' size='1' face='Tahoma, Times New Roman'>please do not respond to this e-mail.

          </font></strong><font color='#666666' size='1' face='Tahoma, Times New Roman'>if you wish to stop receiving e-mails from the michael zavala show, please <a href='http://www.michaelza...email=$ml_email' target='_blank'>unsubscribe[/url].</font><p>
       
        <a href='http://click.linksynergy.com/fs-bin/click?id=tOWLWDAF1Yk&offerid=78941.10001365&type=4&subid=0'><IMG alt='Apple iTunes' border='0' src='http://images.apple.com/itunesaffiliates/US/2006/09/05/MaryJBlige_468x60.jpg'>[/url]<IMG border='0' width='1' height='1' src='http://ad.linksynergy.com/fs-bin/show?id=tOWLWDAF1Yk&bids=78941.10001365&type=4&subid=0'>
       
        </html>";
        mail($to, $subj, $mess, "From: The Michael Zavala Show <show@themichaelzavalashow.com>\n" .
          "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1");
$i++;
      }

      echo("E-mail's have been sent.
");
  };

the output looks great...but the spaces:
this is what i type in:
more...

thanks
michael


but it output for $e_message is:
"more...







thanks



michael"


I hope thats better, I don't know what code tags are

#4 markbett

markbett
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 16 September 2006 - 04:43 AM

its because in addition to the spaces you add in what you type... your code you have adds <p> paragraph breaks

#5 mazman13

mazman13
  • Members
  • PipPipPip
  • Advanced Member
  • 156 posts

Posted 16 September 2006 - 04:54 AM

in my html? my html is working fine, its my string in $e_message from the text area that is throwing up extra spaces. is it because of the nl2br()? i've taken that off only to have it not break anything.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users