Скрипт за пращане на email

Lambenstein

Registered
имам скрипт за регистрации, където съм задал всичко вярно -вече проверих 3 пъти, и при регистрация ти праща активационен имейл, но той никога не пристига, та мисалта ми е, че имам POP3 на хостинг сървъра с мейл сървар и т.н. и искам да накарам систмата да праща имейли през него

кода

Код:
<?php 
 
class Mailer
{
   /**
    * sendWelcome - Sends a welcome message to the newly
    * registered user, also supplying the username and
    * password.
    */
   function sendWelcome($user, $email, $pass, $userid){
      $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">";
      $subject = "Jpmaster77's Site - Welcome!";
      $body = $user.",\n\n"
             ."Welcome! You've just registered at Jpmaster77's Site "
             ."with the following information:\n\n"
             ."Username: ".$user."\n"
             ."Password: ".$pass."\n\n"
             ."Before you can login you need to activate your\n"
             ."account by clicking on this link:\n\n"
             ."http://the-sims-3-stuffs.co.cc/valid.php?qs1=".$user."&qs2=".$userid."\n\n"
             ."If you ever lose or forget your password, a new "
             ."password will be generated for you and sent to this "
             ."email address, if you would like to change your "
             ."email address you can do so by going to the "
             ."My Account page after signing in.\n\n"
             ."- Jpmaster77's Site";

      return mail($email,$subject,$body,$from);
   }
   
   /**
    * sendConfirmation - Sends a confirmation to users
    * who click a "Send confirmation" button.  This
    * only needs to be used if the EMAIL_WELCOME constant
    * is changed to true and the user's 'valid' field is 0
    */
   function sendConfirmation($user, $userid, $email){
       $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">";
       $subject = "jpmaster77's Site - Welcome!";
       $body = $user.",\n\n"
               ."We're sorry for the inconvenience.  We are making\n"
               ."our website more secure for both your and our \n"
               ."benefit.\n\n"
               ."To activate your account you can either click on the\n"
               ."following link or copy the link and paste it into your\n"
               ."address bar.\n\n"
               ."http://the-sims-3-stuffs.co.cc/valid.php?qs1=".$user."&qs2=".$userid."\n\n"
               ."We here at Jpmaster77's Site hope you continue to\n"
               ."enjoy our wonderful service.\n\n"
               ."Sincerely,\n\n"
               ."- Jpmaster77's Site";
               
      return mail($email,$subject,$body,$from);
   }
   
   
   /**
    * sendNewPass - Sends the newly generated password
    * to the user's email address that was specified at
    * sign-up.
    */
   function sendNewPass($user, $email, $pass){
      $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">";
      $subject = "Jpmaster77's Site - Your new password";
      $body = $user.",\n\n"
             ."We've generated a new password for you at your "
             ."request, you can use this new password with your "
             ."username to log in to Jpmaster77's Site.\n\n"
             ."Username: ".$user."\n"
             ."New Password: ".$pass."\n\n"
             ."It is recommended that you change your password "
             ."to something that is easier to remember, which "
             ."can be done by going to the My Account page "
             ."after signing in.\n\n"
             ."- Jpmaster77's Site";
             
      return mail($email,$subject,$body,$from);
   }
};

/* Initialize mailer object */
$mailer = new Mailer;
 
?>

Моля помогнете наистина ми е нужен
 
Аз използвам следното:
<?php
include 'dbc.php';
session_start();
if(!checkAdmin()) {
header("Location: login.php");
exit();
}

$ret = $_SERVER['HTTP_REFERER'];

foreach($_GET as $key => $value) {
$get[$key] = filter($value);
}

if($get['cmd'] == 'approve')
{
mysql_query("update users set approved='1' where id='$get[id]'") or die(mysql_error());
$rs_email = mysql_query("select user_email from users where id='$get[id]'") or die(mysql_error());
list($to_email) = mysql_fetch_row($rs_email);

$host = $_SERVER['HTTP_HOST'];
$host_upper = strtoupper($host);
$login_path = @ereg_replace('admin','',dirname($_SERVER['PHP_SELF']));
$path = rtrim($login_path, '/\\');

$message =
"Здравейте, вашият акаунт в системата е активиран и готов за ползване

*****Данни на потребителя*****\n
http://$host$path/login.php

Приятен ден!!!

Поздрави, Марио Иванов (Администратор
$host_upper
______________________________________________________
Това е автоматично изпратен e-mail.
***Моля не отговаряйте на него****
";

@mail($to_email, "Активиране на потребител", $message,
"От: \"MmPS Бизнес система\" <register@$host>\r\n" .
"X-Mailer: PHP/" . phpversion());


echo "Активиран";


}

if($get['cmd'] == 'ban')
{
mysql_query("update users set banned='1' where id='$get[id]' and `user_name` <> 'admin'");

//header("Location: $ret");
echo "yes";
exit();

}
/* Editing users*/

if($get['cmd'] == 'edit')
{
/* Duplicate user name check */
$rs_usr_duplicate = mysql_query("select count(*) as total from `users` where `user_name`='$get[user_name]' and `id` != '$get[id]'") or die(mysql_error());
list($usr_total) = mysql_fetch_row($rs_usr_duplicate);
if ($usr_total > 0)
{
echo "Sorry! user name already registered.";
exit;
}
/* Duplicate email check */
$rs_eml_duplicate = mysql_query("select count(*) as total from `users` where `user_email`='$get[user_email]' and `id` != '$get[id]'") or die(mysql_error());
list($eml_total) = mysql_fetch_row($rs_eml_duplicate);
if ($eml_total > 0)
{
echo "Sorry! user email already registered.";
exit;
}
/* Now update user data*/
mysql_query("
update users set
`user_name`='$get[user_name]',
`user_email`='$get[user_email]',
`user_level`='$get[user_level]'
where `id`='$get[id]'") or die(mysql_error());
//header("Location: $ret");

if(!empty($get['pass'])) {
$hash = PwdHash($get['pass']);
mysql_query("update users set `pwd` = '$hash' where `id`='$get[id]'") or die(mysql_error());
}

echo "changes done";
exit();
}

if($get['cmd'] == 'unban')
{
mysql_query("update users set banned='0' where id='$get[id]'");
echo "no";

//header("Location: $ret");
// exit();

}


?>
 
най новия и съм му задал аавтоматично да праща майл от register@domain.com и майла дори да не е създаден си праща майли с информация за активация :) при мен работи много добре
 

Back
Горе