Jump to content

Archived

This topic is now archived and is closed to further replies.

mazman13

Need help with mail() problems

Recommended Posts

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.michaelzavala.com/show/mailinglist_unsubscribe.php?action=unsubscribe&ml_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?

Share this post


Link to post
Share on other sites
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??

Share this post


Link to post
Share on other sites
[b]Here is my code:[/b]

//If a message is sent
[color=red]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);[/color]

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

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

sends the e-mails:       
[i][color=navy]//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.michaelzavala.com/show/mailinglist_unsubscribe.php?action=unsubscribe&ml_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++;
      }[/color][/i]
      echo("E-mail's have been sent.
");
  };

[b]the output looks great...but the spaces:[/b]
this is what i type in:
[i]more...

thanks
michael[/i]

[b]but it output for $e_message is:[/b]
[color=limegreen][font=Verdana][font=Verdana]"more...







thanks



michael"[/font][/font][/color]

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

Share this post


Link to post
Share on other sites
its because in addition to the spaces you add in what you type... your code you have adds <p> paragraph breaks

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

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.