...

View Full Version : help, sending email from php script



nurvirus
07-09-2007, 08:47 AM
http://i12.photobucket.com/albums/a208/n_amalyna/email.jpg

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.

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

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



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


and in sendmail.php:



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


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