FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


SMTP Not sending mail out





cLean
Hell guys

I'm sorry for the in-activeness at first

Well my problem consist of me creating a email validation, once i try to use the mail() function it does nothing

I am using mail.xpcpro.net ( host.frihost.net ) as Servers I also set my smtp server in my ini file through my php file. Any ideas on how to fix this ? or what im doing wrong ? Thanks

Code:
<?php
  $fullname = strip_tags($_POST['fullname']);
  $username = strtolower(strip_tags($_POST['username']));
  $useremail = strip_tags($_POST['useremail']);
  $password = strip_tags($_POST['password']);
  $repeatpassword = strip_tags($_POST['repeatpassword']);
  $date = date("Y-m-d");
  $submit = $_POST['submit'];


  if ($submit) {
     include'config/db_config.php';

   $namecheck = mysql_query("SELECT username FROM users WHERE username ='$username'");
   $count = mysql_num_rows($namecheck);
       if ($count!=0) {
          die("Username Already Exist!");
       }

     if ($username&&$fullname&&$useremail&&$password&&$repeatpassword) {

         if ($password==$repeatpassword) {
            if (strlen($username)>25||strlen($fullname)>25) {

              echo "Length of username or fullname is too long!";

              }
             else {

                if (strlen($password)>25||strlen($password)<6) {

                   echo "Password must be between 6 and 25 characters";

                }
                else {

                   // encrypt pass
                   $password = md5($password);
                   $repeatpassword = md5($repeatpassword);

                   // generate random number
                   $random = rand(23456789,98765432);


                   //register the user
                  include'config/db_config.php';
                  $query = mysql_query("INSERT INTO users VALUES ('', '$fullname', '$username', '$useremail', '$password', '$date', '$random', '0')");

                  $lastid = mysql_insert_id();


                  $body = "
                  Hello $fullname,\n\n
                  You need to activate your account with the link below:\n\n
                  http://xpcpro.net/xpcpro/cms/activate.php?id=$lastid&code=$random \n\n
                  Thanks
                  ";

                  $to = $useremail;
                  $subject = "Activate your account!";
                  $headers = "From: <removed>";
                  $server = "mail.xpcpro.net";

                  ini_set("SMTP", "mail.xpcpro.net");

                  // function to send mail
                  mail($to, $subject, $body, $headers);

                  die("You have been registered! Check your email to activate your account");                }

             }
          }
   else
      echo "Your passwords do not match!";

     }
        else
         echo "Please fill in <b>all</b> fields!";
  }


?>

<html>
<head>
   <p>
   <h1>Register</h1>
</head>

<body>

<form action='register.php' method='post'>

   <table>
   <tr>
      <td>
         Your full name:
      </td>
   <td>
      <input type='text' name='fullname' value='<?php echo $fullname; ?>'>
   </td>
      </tr>
   <tr>
      <td>
      Choose a username:
      </td>
   <td>
      <input type='text' name='username' value='<?php echo $username; ?>'>
   </td>
      </tr>
         <tr>
      <td>
      Enter your email:
      </td>
   <td>
      <input type='text' name='useremail' value='<?php echo $useremail; ?>'>
   </td>
      </tr>
   <tr>
      <td>
      Choose a password:
      </td>
   <td>
      <input type='password' name='password'>
   </td>
      </tr>
   <tr>
      <td>
      Repeat password:
      </td>
   <td>
      <input type='password' name='repeatpassword'>
   </td>
      </tr>
   </table>

 <input type='submit' name='submit' value='Register'>
</form>

</body>

</html>


Code:

$to = $useremail;
                  $subject = "Activate your account!";
                  $headers = "From: <removed>";
                  $server = "mail.xpcpro.net";

                  ini_set("SMTP", "mail.xpcpro.net");

                  // function to send mail
                  mail($to, $subject, $body, $headers);


Above is the whole code the 2nd is the code im referring to
The code after this works I get my message stating i am registered
Bondings
Normally you don't need to set any smtp server, I assume that might be causing your problem. Have you tried it without the ini_set line?
cLean
Yes i sure have i done that first .
cLean
No ideas guys ??
Bondings
I tried with a test_mail.php script in your account and it was able to send it to my email address. I changed it to yours now.

I'll remove your email address from the forums, by the way, since otherwise spam bots might find it.
cLean
so what are you saying ? hehe . That it works ? but just my script ? unno?

Could it be that the file is stored 3 - 4 directors inside the account ? NONO ?

Honestly i dont see why it wouldn't send . It creates the account, sends the Account Created message. Just dont send email validation
Bondings
Maybe it went to your spam folder or was blocked by your email client or something like that?
cLean
Sad I wish I have tried hotmail also.. But the email you sent worked! UNNO!?!??!?!
Bondings
cLean wrote:
Sad I wish I have tried hotmail also.. But the email you sent worked! UNNO!?!??!?!

Yes, I tried it with the test_mail.php script in your public_html directory, but with to a gmail email address. It got in the spam folder though, if I'm not mistaken.
Related topics
Mail with PHP (Simple Tutorial)
php mailing script
writing COM components in Perl
Looking for easy FormMail Script
Sending mail with flash using PHP
Is Pop3 email working
No mail sending on Outlook 2003
Problems with the pop3 email
[SOLVED] == Thunderbird, POP3 email problem not solved
SMTP Busted
Problem with email through Thunderbird
I want my subdomain mail server to require password on send!
Unable sending mail - verification error
Trouble sending e-mail to hotmail
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.