Re: Webmail
| From: | Mike Eheler | Date: | Tue, 05 Mar 2002 20:59:51 +0000 |
| Subject: | Re: Webmail | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-87349@lists.php.net to get a copy of this message | ||
It's really quite simple. Here's a quick script that will dump all
variables sent in a form to an email address:
$email = 'info@domain.com';
$subject = 'Form Posted on ' . date('r');
$from = '"Your Website" <noreply@domain.com>';
$message = '';
// PHP up to 4.0.6
foreach ($HTTP_POST_VARS as $key => $value) {
$message .= "$key: $value\n";
}
// PHP 4.1.0+
foreach ($_REQUEST as $key => $value) {
$message .= "$key: $value\n";
}
mail($email, $subject, $message, "From: $from");
More information can be found at
http://www.php.net/manual/en/function.mail.php
Mike
On Tue, 05 Mar 2002 12:48:29 -0800, Webmaster - Myonlinesite.Co.Uk And
.Com wrote:
> Hi
>
> can anyone quickly run through how to use php to send the contents of a
> form via e-mail using sendmail? How do you begin?
>
> thanks
>
> james@myonlinesite.co.uk