Jump to content

Recommended Posts

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
  }
?>

 

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.