Secure PHP Mail Script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Brad7928
Forum Commoner
Posts: 39
Joined: Thu Jan 29, 2009 4:54 pm

Secure PHP Mail Script

Post by Brad7928 »

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:

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";
}
?>
 
Post Reply