-1

i try to send verification mail for registring from my website the probleme that i had is that the code didn't giving me any error but it not sending any mail this the code:

$connect=mysql_connect('mysql.hostinger.fr','u423178114_user','pass')or die('erreur');
   mysql_select_db('u423178114_gm');
   $reg=mysql_query("SELECT * FROM users WHERE username='$username'");
   $rows=mysql_num_rows($reg);
   if($rows==0)
   {
    $token=rand('19849','98765');
    $query=mysql_query("INSERT INTO users VALUES('','$fname','$lname','$email','$tele','$username','$password1','$password2','$token','0')");
    $derid=mysql_insert_id();
    //email
    $to=$email;
    $subject="Activation du compte";
    $en_tete="FROM: admin@groupemaghreb.besaba.com";
    $server='mx1.hostinger.fr';
    ini_set('SMTP',$server);
    ini_set('sendmail_from', 'admin@groupemaghreb.besaba.com');
    ini_set('smtp_port', '2525');
    ini_set(auth, true);
    ini_set('username','admin@groupemaghreb.besaba.com');  
    ini_set('password','pass');
    $body="Hello cliquer ici pour activer votre compte
    <a href='http://www.groupemaghreb.besaba.com/site/active.php?id='$derid'&code=$token'></a>";
    error_reporting (E_ALL); 
    ini_set ('display_errors', '1');
    mail($to,$subject,$en_tete,$body);
    if (mail($to,$subject,$en_tete,$body)) {  
    echo("<p>Email successfully sent!</p>");  }
    else {   echo("<p>Email delivery failed…</p>");  }
    //die("Inscription terminé <a href='index.html'> connectez </a> vous");
    //die("Inscription terminén consultez votre email");
    
   }else echo"Ce utilisateur n'est pas disponible";

1 Answers1

0

I think you meant to send using port 25 (standard SMTP) rather than 2525.

Peter Bowers
  • 3,063
  • 1
  • 10
  • 18
  • no it's 2525 its a port of smtp of my sub domain that i had create by hostlinger. when i test the server and the port by send mail using java it work but in php not – KARIMI KHADIJA Mar 15 '15 at 15:35