Mail Function

Mail Function

am 01.03.2006 22:58:41 von mbomgardner

--------------070609050200020907080308
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I have been racking my brain for the better part of a day with a simple
mail function. I am trying to generate a list of events from MySQL and
then use the php Mail function to email the list in an html email to a
mailing list. I keep getting a parse error on a section that I can not
figure out why.

The code is attached

Markb

--------------070609050200020907080308
Content-Type: text/plain;
name="email_problem.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="email_problem.txt"

require_once('../../Connections/flatfoot.php');
mysql_select_db($database_flatfoot, $flatfoot);
$query_Recordset1 = "SELECT * FROM tblTrnEvent WHERE tblTrnEvent.Sdate BETWEEN '2006-03-02' AND '2006-04-30' AND Etype = 'K' ORDER BY Sdate";
$Recordset1 = mysql_query($query_Recordset1, $flatfoot) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

mail('mbomgardner@kletc.org','Test Mail Message',
'



Up Coming Training























Upcoming Training Event
Sponsored by The Kansas Law Enforcement Training Center
 

Listed below, you’ll find an assortment of Specialized Training classes being offered by the Kansas Law Enforcement Training Center during the months of March and April. Of special interest are the Ethics Instructor class being offered March 13 – 17; Field Training Officer class being offered March 13 – 15 in Dodge City; Crime Scene and Arson Photography class offered March 16 – 17. These classes should have a significant impact on those officers attending, providing new insight and expertise to your agency.

 






'.
do {
if($row_Recordset1['special'] =='Y'){
.'




'.

}else{
.'




'.

}
}

while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)).'
Start Date Project Number Class Title Location
'.date("m/d/Y", strtotime($row_Recordset1['Sdate'])).' '.$row_Recordset1['pnumber'].' '.$row_Recordset1['title'].' .'$row_Recordset1['city'].'
'.date("m/d/Y", strtotime($row_Recordset1['Sdate'])).' '.$row_Recordset1['pnumber'].' '.$row_Recordset1['title'].' '.$row_Recordset1['city'].'



'.mysql_free_result($Recordset1).'')
?>


--------------070609050200020907080308
Content-Type: text/plain; charset=us-ascii

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--------------070609050200020907080308--

Re: Mail Function

am 01.03.2006 23:19:26 von mlists

Mark Bomgardner wrote:
> I have been racking my brain for the better part of a day with a simple
> mail function. I am trying to generate a list of events from MySQL and
> then use the php Mail function to email the list in an html email to a
> mailing list. I keep getting a parse error on a section that I can not
> figure out why.

ok, this is a general PHP question not realy a php-db type but 'sall good ;)

a) the parse error is likely form a rogue quote (in the html perhaps)
making a syntax error, hard to say with out the actual error

b) are you sure mail() can tell that that is html and create the
appropriate multi part MIME message? Highly doubtful since all mail()
does is pipe the data to sendmail, I'd recommend using a valid MIME/SMTP
tool like Perl's Mail::Sender::Easy module
(http://search.cpan.org/perldoc?Mail::Sender::Easy)

You can easily use Perl's DBI to do your MySQL query so there really is
no need to try to hack up PHP's lame mail() function to do something it
simply can't.

HTH

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Mail Function

am 02.03.2006 00:07:22 von Philip Pryce

------=_Part_4318_4980500.1141254442271
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

You can have

'blah'.}
else {
..'blah'

because that is what you currently have.

------=_Part_4318_4980500.1141254442271--

Re: Mail Function

am 02.03.2006 00:07:54 von Philip Pryce

------=_Part_4326_14467636.1141254474991
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

opps sorry for the typos
"you cant have"

------=_Part_4326_14467636.1141254474991--