sayedsohail Posted March 14, 2007 Share Posted March 14, 2007 Hi everyone, Can someone advise, how do make my localhost to send the my feedback form via my isp smtp server. please advise, here is my mail.php form. <?php function is_email_valid($email) { if(eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$", $email)) return TRUE; else return FALSE; } $t_email = $_POST['t_email']; $f_email = $_POST['f_email']; $subject = $_POST['subject']; $message = $_POST['message']; $send = $_POST['send']; if ( $t_email && $f_email && $subject && $message && $send ) { if (is_email_valid($t_email) && is_email_valid($f_email)) { echo "Sending email...<p />"; echo 'mail( $t_email, $subject, $message, "From: $f_email\r\n")<p />'; echo "And this expands to:<p />"; echo ' mail( '. $t_email .', '. $subject .', '. $message .', "From: '. $f_email .'\r\n");<p />'; mail($t_email, $subject, $message, "From: $f_email\r\n"); } else { if ( !is_email_valid($t_email) ) { echo "<b>To</b> email address was <b>invalid</b><br />"; } if ( !is_email_valid($f_email) ) { echo "<b>From</B> email address was <b>invalid</b><br />"; } } } else { ?> <form method=post action="mail.php"> <table border=0> <tr><td>To Email Address:</td> <td><input type="text" name="t_email" value="Valid Email Address"></td></tr> <tr><td>From Email Address:</td> <td><input type="text" name="f_email" value="Valid Email Address"></td></tr> <tr><td>Subject:</td> <td><input type="text" name="subject" value="Subject Here"></td></tr> <tr><td colspan=2>Message:<br /> <textarea cols=28 rows=5 wrap=physical name="message"> Message Here </textarea><p /></td></tr> <tr><td colspan=2><input type="submit" name="send" value="Send Email"> <input type="reset" value="Reset Form"></td></tr> </table> </form> <?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/42709-how-do-i-configure-my-localhost-machine-to-send-email-via-my-isp/ Share on other sites More sharing options...
per1os Posted March 14, 2007 Share Posted March 14, 2007 http://us2.php.net/manual/en/ref.mail.php Read that, it allows you to set up a smtp server, thats what you need. --FrosT Quote Link to comment https://forums.phpfreaks.com/topic/42709-how-do-i-configure-my-localhost-machine-to-send-email-via-my-isp/#findComment-207215 Share on other sites More sharing options...
sayedsohail Posted March 14, 2007 Author Share Posted March 14, 2007 You mean to use php pear, this looks very simple mail setup function. do we have any other way to do it without using pear library. Quote Link to comment https://forums.phpfreaks.com/topic/42709-how-do-i-configure-my-localhost-machine-to-send-email-via-my-isp/#findComment-207225 Share on other sites More sharing options...
sayedsohail Posted March 15, 2007 Author Share Posted March 15, 2007 Sorry guys asking this again, I just need to know how to setup my smtp server on my localhost server. so i can start sending and received email using my feedback form. Quote Link to comment https://forums.phpfreaks.com/topic/42709-how-do-i-configure-my-localhost-machine-to-send-email-via-my-isp/#findComment-207903 Share on other sites More sharing options...
obsidian Posted March 15, 2007 Share Posted March 15, 2007 I would recommend you take a good look at PHPMailer for your SMTP connection. There is a great email class as well as a full SMTP class included in the package, and they work wonderfully. Hope this helps. Quote Link to comment https://forums.phpfreaks.com/topic/42709-how-do-i-configure-my-localhost-machine-to-send-email-via-my-isp/#findComment-207921 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.