Secure PHP Mail Script
Posted: Tue Feb 03, 2009 5:01 pm
I'm after a php script that:
- Has a form that i can put into a .html page that calls the script,
- Is able to tell a smpt server that it is USER: xxxx with a PASS: xxxx
I have set up my mail server to not allow relaying, so when i use other mailing scripts, my SMTP server gets it but won't forward it on because no user/mail from was specified.
Can anyone help me out? Or is this relating to a setting in my php.ini file? i think i can remember one being in there relating to this...
This is the script i have at the moment:
- Has a form that i can put into a .html page that calls the script,
- Is able to tell a smpt server that it is USER: xxxx with a PASS: xxxx
I have set up my mail server to not allow relaying, so when i use other mailing scripts, my SMTP server gets it but won't forward it on because no user/mail from was specified.
Can anyone help me out? Or is this relating to a setting in my php.ini file? i think i can remember one being in there relating to this...
This is the script i have at the moment:
Code: Select all
<?php
// Contact subject
$subject ="$subject";
// Details
$message="$detail";
// Mail of sender
$mail_from="$customer_mail";
// From
$header="from: $name <$mail_from>";
// Enter your email address
$to ='Brad@forum-indoor.info';
$send_contact=mail($to,$subject,$message,$header, "From: Brad@forum-indoor.info");
// Check, if message sent to your email
// display message "Thanks for the message!"
if($send_contact){
header("Location: contact_success.html");
}
else {
echo "ERROR";
}
?>