Re: [PHP] mail() php in message

2003-10-13 Thread Manuel Lemos
Hello,

On 10/13/2003 06:13 AM, Onno Kuipers wrote:
My server runs PHP and Mysql. Normaly I can put some php in my 
.php-files wich will create a html file for the clients. (you all 
know this of course).

My question now is: How can I put that html (created with PHP) in the 
message off the mail.


To not have to change your PHP code, you may capture the HTML you want 
to mail by enclosing your PHP code between a ob_start() and a 
ob_get_clean() commands, like this:

ob_start();

... your code here:

$message=ob_get_clean();

And then use the $message variable to compose an HTML message.

Sending an HTML message properly requires that you compose a message 
according to the MIME standards. Just try this class that makes it easy:

http://www.phpclasses.org/mimemessage

thanx a lot! I think this will help. .

 oops works only with PHP 4... and I ... euh PHP3..

Is there another method to do this before I even think of upgrading?
No, there is no support for capturing output data in PHP 3. The MIME 
message class works in PHP 3, but to capture the output in PHP 3 you 
need to change your code to assign a variable with the output data 
instead of using output buffering functions.

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mail() php in message

2003-10-13 Thread Marek Kilimajer
Onno Kuipers wrote:

thanx a lot! I think this will help. .

 oops works only with PHP 4... and I ... euh PHP3..

Is there another method to do this before I even think of upgrading?

You can write your own. But I would upgrade.

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


Re: [PHP] mail() php in message

2003-10-13 Thread Onno Kuipers
Manuel Lemos wrote:
Hello,

On 10/13/2003 05:02 AM, Onno Kuipers wrote:

My server runs PHP and Mysql. Normaly I can put some php in my 
.php-files wich will create a html file for the clients. (you all know 
this of course).

My question now is: How can I put that html (created with PHP) in the 
message off the mail.


To not have to change your PHP code, you may capture the HTML you want 
to mail by enclosing your PHP code between a ob_start() and a 
ob_get_clean() commands, like this:

ob_start();

... your code here:

$message=ob_get_clean();

And then use the $message variable to compose an HTML message.

Sending an HTML message properly requires that you compose a message 
according to the MIME standards. Just try this class that makes it easy:

http://www.phpclasses.org/mimemessage

thanx a lot! I think this will help. .

 oops works only with PHP 4... and I ... euh PHP3..

Is there another method to do this before I even think of upgrading?

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


Re: [PHP] mail() php in message

2003-10-13 Thread Onno Kuipers
Manuel Lemos wrote:
Hello,

On 10/13/2003 05:02 AM, Onno Kuipers wrote:

My server runs PHP and Mysql. Normaly I can put some php in my 
.php-files wich will create a html file for the clients. (you all know 
this of course).

My question now is: How can I put that html (created with PHP) in the 
message off the mail.


To not have to change your PHP code, you may capture the HTML you want 
to mail by enclosing your PHP code between a ob_start() and a 
ob_get_clean() commands, like this:

ob_start();

... your code here:

$message=ob_get_clean();

And then use the $message variable to compose an HTML message.

Sending an HTML message properly requires that you compose a message 
according to the MIME standards. Just try this class that makes it easy:

http://www.phpclasses.org/mimemessage

thanx a lot! I think this will help.

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


Re: [PHP] mail() php in message

2003-10-13 Thread Manuel Lemos
Hello,

On 10/13/2003 05:02 AM, Onno Kuipers wrote:
My server runs PHP and Mysql. Normaly I can put some php in my 
.php-files wich will create a html file for the clients. (you all know 
this of course).

My question now is: How can I put that html (created with PHP) in the 
message off the mail.
To not have to change your PHP code, you may capture the HTML you want 
to mail by enclosing your PHP code between a ob_start() and a 
ob_get_clean() commands, like this:

ob_start();

... your code here:

$message=ob_get_clean();

And then use the $message variable to compose an HTML message.

Sending an HTML message properly requires that you compose a message 
according to the MIME standards. Just try this class that makes it easy:

http://www.phpclasses.org/mimemessage

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mail() php in message

2003-10-13 Thread Onno Kuipers
Chris Hayes wrote:

message of the mail. I know how the to put html in the message:

$message = '


in stead of

 print " $gebruikerbooks ";


do

 $message .= " $gebruikerbooks ";

A little clarification:
* Just instead of echoing it directly to the browser, add it to your 
variable $message.
* "$message.='bla';" is a shortcut for   "$message.=$message . 'bla'; "
* the . is the glue for strings.


Thanx for your reaction. But I am not sure if I explained my problem the 
right way. Let me say it a little bit different:

My server runs PHP and Mysql. Normaly I can put some php in my 
.php-files wich will create a html file for the clients. (you all know 
this of course).

My question now is: How can I put that html (created with PHP) in the 
message off the mail.

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


Re: [PHP] mail() php in message

2003-10-12 Thread Chris Hayes

message of the mail. I know how the to put html in the message:

$message = '
in stead of
 print " $gebruikerbooks ";
do

 $message .= " $gebruikerbooks ";

A little clarification:
* Just instead of echoing it directly to the browser, add it to your 
variable $message.
* "$message.='bla';" is a shortcut for   "$message.=$message . 'bla'; "
* the . is the glue for strings.

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


Re: [PHP] mail() php in message

2003-10-12 Thread Onno Kuipers
Matthias Wulkow wrote:
Hallo Onno,

am Sonntag, 12. Oktober 2003 um 20:07 hast Du Folgendes gekritzelt:

OK> Hi,

OK> is there a way to create a mail (with the mail() function) that contains 
OK>   php in the message.

OK> Like:

OK>  $to  = "[EMAIL PROTECTED]";
OK> $subject = "a subject";
OK> $message = 
OK> I WANT TO PUT SOME PHP IN HERE TO CREATE A TABLE IN THE MESSAGE:

OK> $columnbooks = mysql_list_fields($dbname,tmp,$mysql_link);
OK> $sqlbooks = "select isbn,books.title, writer, publisher from tmp,books 
OK> where tmp.user=books.user";
OK> $resultbooks = mysql_db_query($dbname,$sqlbooks);
?>>
OK> >
OK> 
OK> while   ($valuebooks = mysql_fetch_array($resultbooks))
OK> {   print "";
OK>  for($i=0; $i< 4; $i++ )
OK>  {
OK>  $gebruikerbooks=$valuebooks[$i];
OK>  print " $gebruikerbooks ";
OK>  }
OK>  print "";
OK> }
OK> mysql_free_result($resultbooks);

OK> THIS SHOULD BE THE END OF THE MESSAGE
 

OK> HERE I WILL DO THE MAILING

OK> mail($to,$subject,$message);
?>>
You should know that php runs on a server, not on the client machine. So what do 
you want to
do with php-code in a mail? You could put html (generated by php for
example), so that the mail-reader can display a table.
That is exactly what I want to do. I've got a mysql database. I want to 
generate a table with data from the database into the message of the 
mail. I know how the to put html in the message:

$message = '


Here are the birthdays upcoming in August!

 
  PersonDayMonthYear
 
 
  Joe3rdAugust1970
 
 
  Sally17thAugust1973
 



';
but I want to know how to put html generated by php in the message.

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


Re: [PHP] mail() php in message

2003-10-12 Thread Matthias Wulkow
Hallo Onno,

am Sonntag, 12. Oktober 2003 um 20:07 hast Du Folgendes gekritzelt:

OK> Hi,

OK> is there a way to create a mail (with the mail() function) that contains 
OK>   php in the message.

OK> Like:

OK>  $to  = "[EMAIL PROTECTED]";
OK> $subject = "a subject";
OK> $message = 

OK> I WANT TO PUT SOME PHP IN HERE TO CREATE A TABLE IN THE MESSAGE:

OK> $columnbooks = mysql_list_fields($dbname,tmp,$mysql_link);
OK> $sqlbooks = "select isbn,books.title, writer, publisher from tmp,books 
OK> where tmp.user=books.user";
OK> $resultbooks = mysql_db_query($dbname,$sqlbooks);
?>>
OK> >
OK>  while   ($valuebooks = mysql_fetch_array($resultbooks))
OK> {   print "";
OK>  for($i=0; $i< 4; $i++ )
OK>  {
OK>  $gebruikerbooks=$valuebooks[$i];
OK>  print " $gebruikerbooks ";
OK>  }
OK>  print "";
OK> }
OK> mysql_free_result($resultbooks);

OK> THIS SHOULD BE THE END OF THE MESSAGE
 

OK> HERE I WILL DO THE MAILING

OK> mail($to,$subject,$message);
?>>


You should know that php runs on a server, not on the client machine. So what do you 
want to
do with php-code in a mail? You could put html (generated by php for
example), so that the mail-reader can display a table.


SvT


-- 
Who is the ennemy?

mailto:[EMAIL PROTECTED]

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



[PHP] mail() php in message

2003-10-12 Thread Onno Kuipers
Hi,

is there a way to create a mail (with the mail() function) that contains 
 php in the message.

Like:


I WANT TO PUT SOME PHP IN HERE TO CREATE A TABLE IN THE MESSAGE:

$columnbooks = mysql_list_fields($dbname,tmp,$mysql_link);
$sqlbooks = "select isbn,books.title, writer, publisher from tmp,books 
where tmp.user=books.user";
$resultbooks = mysql_db_query($dbname,$sqlbooks);
?>


while   ($valuebooks = mysql_fetch_array($resultbooks))
{   print "";
for($i=0; $i< 4; $i++ )
{
$gebruikerbooks=$valuebooks[$i];
print " $gebruikerbooks ";
}
print "";
}
mysql_free_result($resultbooks);

THIS SHOULD BE THE END OF THE MESSAGE

HERE I WILL DO THE MAILING

mail($to,$subject,$message);
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php