View Full Version : help, sending email from php script

07-09-2007, 07:47 AM

anyone know how to send email from php script without using Outlook? Before i've manage to do the email form but then outlook will pop up so i have to login outlook first. That is very unconvinient. Maybe someone can show me how to send email direct from php script or at least a reference?

Thank you.

07-09-2007, 10:24 AM
PHP has a mail function (http://www.php.net/mail)

07-09-2007, 10:51 AM
I would do the following:

<form method="post" action="/sendmail.php">
<input type="submit" name="submit" value="Submit" />

and in sendmail.php:

if (isset($_POST['submit'])){
$to = 'admin_email';
$subject = 'email_subject';
$message = 'message to send';
header('Location: /thankyou.php');
} else {
header('Location: /back_to_form.php);

I would generally post the form to the same page that called it and inclde the above php code at the top of the page checking for posting and if not, display the form.

Hope this helps.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum