Home > Archive > PHP Language > July 2004 > Re: Need mail() assistance..
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: Need mail() assistance..
|
|
| Janwillem Borleffs 2004-07-28, 8:56 pm |
| Charles Waters wrote:
> I have a file called success.php that I would like to have the
> contents of that file be the contents of the email message... Is
> there a way to call the mail(); function to send that success.php
> file as the actual email, instead of as an attachment!?
>
The straightforward answer would be to use the output of success.php as the
third argument of the mail() call, but I have a feeling this doesn't help
you because success.php contains some echo'ed (or printed) strings.
When this is the case, output buffering might be what you are looking for:
<?
ob_start();
include "success.php";
$content = ob_get_contents();
ob_end_clean();
mail ($recepient, $subject, $content);
?>
JW
| |
|
| "Janwillem Borleffs" wrote:
> Charles Waters wrote:
>
> The straightforward answer would be to use the output of
success.php
> as the
> third argument of the mail() call, but I have a feeling this
> doesn’t help
> you because success.php contains some echo’ed (or printed)
> strings.
>
> When this is the case, output buffering might be what you are
looking
> for:
>
> <?
>
> ob_start();
>
> include "success.php";
>
> $content = ob_get_contents();
> ob_end_clean();
>
> mail ($recepient, $subject, $content);
>
> ?>
>
>
> JW
this would work. Just make sure to escape characters properly, and
change html to ascii as applicable (e.g. <br> to crlf). There are
functions in php to remove html tags, etc. Would have to do quite a
bit of translation.
--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-mail-as...pict134323.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=448677
|
|
|
|
|