Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]mailing
darkowski
post
Post #1





Grupa: Zarejestrowani
Postów: 68
Pomógł: 0
Dołączył: 28.04.2008
Skąd: Auschwitz

Ostrzeżenie: (0%)
-----


Witam
Używam CMSa phpbp i tam jest opcja mailing, chciałbym się dowiedzieć jak zrobić żeby maile które wysyłam do userów były w stylu takim jak wysyłają reklamy np. interia, albo jakieś banki. Bo te maile co ja wysyłam są takie bezpłciowe a nadodatek nie zamiast polskich znaków są jakieś kwadraty
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
darkowski
post
Post #2





Grupa: Zarejestrowani
Postów: 68
Pomógł: 0
Dołączył: 28.04.2008
Skąd: Auschwitz

Ostrzeżenie: (0%)
-----


mailing.php
  1. <?php
  2. $autoload='external';
  3. function mailing_send()
  4. {
  5.  global $lang, $conf;
  6.  
  7.  if(!perms_check('admin', 'mailing'))
  8.  {
  9.    redirect('index.php?module=error&error=auth_error');
  10.    exit;
  11.  }
  12.  
  13.  $db=new dbquery;
  14.  
  15.  if(function_exists(mail))
  16.  {  
  17.    $message = read_text_rest($_POST['message']."\n\n-- -- -- -- -- -- -- --\n\n".$conf['mailing_signature']);
  18.    $subject=read_text_rest($conf['adress'].' - '.$_POST['subject']);
  19.  
  20.    if($_POST['how'] == 'all')
  21.    {
  22.      
  23.      $db->query("SELECT * FROM $conf[prefix_users]users WHERE mailing = 1 and active = 1") or $db->err(__FILE__, __LINE__);
  24.      
  25.      while($d = $db->fetch_object())
  26.      {
  27.        if(!mail($d->mail, $subject, $message, "From: $conf[mailing_from]r\n"."Reply-To: $conf[mailing_reply_to]r\n"."X-Mailer: PHP/".phpversion()))
  28.        {
  29.          redirect('index.php?module=admin&action=mailing&what=notsent');
  30.          exit;
  31.        }        
  32.      }
  33.    }
  34.    elseif($_POST['how'] == 'users')
  35.    {
  36.     for($i = 0; $i < count($_REQUEST['users']); $i++)
  37.     {
  38.        SQLvalidate($_REQUEST['users'][$i]);
  39.        
  40.         $db->query("SELECT * FROM $conf[prefix_users]users WHERE mailing = 1 and active = 1 and id = ".$_REQUEST['users'][$i]) or $db->err(__FILE__, __LINE__);
  41.         $u = $db->fetch_object();
  42.        
  43.         if(!mail($u->mail, $_POST['subject'], $message, "From: $conf[mailing_from]r\n"."Reply-To: $conf[mailing_reply_to]r\n"."X-Mailer: PHP/".phpversion()))
  44.         {
  45.           redirect('index.php?module=admin&action=mailing&what=notsent');
  46.           exit;
  47.         }    
  48.     }
  49.    }
  50.    elseif($_POST['how'] == 'groups')
  51.    {
  52.      $db2=new dbquery;
  53.      for($i = 0; $i < count($_REQUEST['groups']); $i++)
  54.     {
  55.       SQLvalidate($_REQUEST['groups'][$i]);
  56.        
  57.        $db2->query("SELECT * FROM $conf[prefix_users]users WHERE mailing = 1 and active = 1 and gid = $_REQUEST[groups][$i]") or $db->err(__FILE__, __LINE__);
  58.        while($u = $db2->fetch_object())
  59.        {
  60.          if(!mail($u->mail, $_POST['subject'], $message, "From: $conf[mailing_from]r\n"."Reply-To: $conf[mailing_reply_to]r\n"."X-Mailer: PHP/".phpversion()))
  61.          {
  62.            redirect('index.php?module=admin&action=mailing&what=notsent');
  63.            exit;
  64.          }    
  65.        }      
  66.    }
  67.    }
  68.    redirect('index.php?module=admin&action=mailing&what=sent');
  69.    exit;
  70.  }
  71.  redirect('index.php?module=admin&action=mailing&what=notsent');
  72.  exit;
  73. }
  74. ?>


mailing_external.php
  1. <?php
  2.  
  3. function lost_password()
  4. {
  5.  global $lang, $conf;
  6.  
  7.  $db=new dbquery;
  8.  
  9.  if($_POST['login'] or $_POST['email'])
  10.  {
  11.  
  12.    if($_POST['login'])
  13.     $sql="login='$_POST[login]'";
  14.    if($_POST['email'])
  15.     $sql="mail='$_POST[email]'";
  16.    
  17.    $db->query("SELECT * FROM $conf[prefix_users]users WHERE $sql") or $db->err(__FILE__, __LINE__);
  18.  
  19.   if($db->num_rows()==0)
  20.   {
  21.     redirect('index.php?module=error&error=login_error1');
  22.     exit;
  23.   }
  24.  
  25.   $d=$db->fetch_object();
  26.  
  27.   $code=md5($d->pass);
  28.   $id_=$d->id;
  29.  
  30.   $link=$conf['adres'].'index.php?module=images&function=lost_password_send&id='.$id_.'&code='.$code;
  31.    
  32.   $title=string_template($lang['lost_pass_title'], array('adress'=>$conf['adress']));
  33.   $message=string_template($lang['lost_pass_msg'], array('link'=>$link));
  34.  
  35.   if([email="!@mail($d-mail"]!@mail($d->mail[/email], $title, $message, "From: $conf[mailing_from]"))
  36.   {
  37.     redirect('index.php?module=error&error=mailing_error');
  38.      exit;
  39.   }
  40.    else
  41.   {
  42.     redirect('index.php?module=info&info=lost_pass_info1');
  43.      exit;
  44.   }
  45.  }
  46.  
  47.  redirect('index.php');
  48.  exit;          
  49. }
  50.  
  51. function lost_password_send()
  52. {
  53.  global $lang, $conf;
  54.  
  55.  SQLvalidate($_GET['id']);
  56.  
  57.  if($_GET['id'] && $_GET['code'])
  58.  {
  59.     $db->query("SELECT * FROM $conf[prefix_users]users WHERE id=$_GET[id]") or $db->err(__FILE__, __LINE__);
  60.  
  61.    if($db->num_rows()==0)
  62.    {
  63.      redirect('index.php?module=error&error=login_error1');
  64.      exit;
  65.    }
  66.  
  67.    $d=$db->fetch_object();
  68.  
  69.    if(md5($d->pass)!=$_GET['code'])
  70.    {
  71.         redirect('index.php?module=error&error=lost_pass_error1');
  72.         exit;    
  73.    }
  74.  
  75.    $time=time();
  76.    $pass_=substr($time, (strlen($time)-6), strlen($time));
  77.    $pass=md5($pass_);
  78.  
  79.    $title=string_template($lang['lost_pass_title'], array('adress'=>$conf['adress']));
  80.    $message=string_template($lang['lost_pass_send'], array('login'=>$d->login, 'pass'=>$pass_));
  81.  
  82.    if([email="!@mail($d-mail"]!@mail($d->mail[/email], $title, $message, "From: $conf[mailing_from]"))
  83.    {
  84.      redirect('index.php?module=error&error=mailing_error');
  85.       exit;
  86.    }
  87.     else
  88.    {
  89.       $db->query("UPDATE $conf[prefix_users]users SET pass='$pass' WHERE id=$_GET[id]") or $db->err(__FILE__, __LINE__);
  90.      redirect('index.php?module=info&info=lost_pass_info2');
  91.       exit;
  92.    }    
  93.  }
  94.  
  95.  redirect('index.php');
  96.  exit;    
  97. }
  98.  
  99. ?>




i jeszcze jedno maling.php

  1. <?php
  2. global $lang, $conf;
  3.  
  4. if(!perms_check('admin', 'mailing'))
  5. {
  6.  redirect('index.php?module=error&error=auth_error');
  7.  exit;
  8. }
  9.  
  10.  
  11. if($_GET['what'] == 'sent')
  12. {
  13.  $content = $lang['mailing_sent'];
  14. }
  15. elseif(!function_exists(mail) or $_GET['what'] == 'notsent')
  16. {
  17.  $content = $lang['mailing_error'];
  18. }
  19. else
  20. {
  21.  //groups list
  22.  
  23.  //adding admins
  24.  $groups_list = '<option value="3">'.groups_get_name_by_id(3).'</option>\n';
  25.  
  26.  
  27.  //adding users
  28.  $groups_list .= '<option value="2">'.groups_get_name_by_id(2).'</option>\n';
  29.  
  30.  
  31.  //adding rest
  32.  $query = "SELECT * FROM $conf[prefix_groups]groups WHERE type != -1 ORDER BY type ASC";
  33.  $result = mysql_query($query) or die(mysql_error($mysql_connect));  
  34.  
  35.  while($g = mysql_fetch_object($result))
  36.  {
  37.    $name = groups_get_name_by_id($g->id);
  38.    $groups_list .= "<option value=\"$g->id\">$name</option>\n";
  39.  }
  40.  //
  41.  
  42.  $users_list = NULL;
  43.  
  44.  //users list
  45.  $query = "SELECT * FROM $conf[prefix_users]users ORDER BY login ASC";
  46.  $result = mysql_query($query) or die(mysql_error($mysql_connect));  
  47.  
  48.  while($u = mysql_fetch_object($result))
  49.  {
  50.    $users_list .= "<option value=\"$u->id\">$u->login</option>\n";
  51.  }
  52.  //
  53.  
  54.  $content = string_template(read_file($theme_path.'admin/mailing_form.php'), array("groups_list" => $groups_list, "users_list" => $users_list));
  55. }
  56.  
  57. $content=string_template(read_file($theme_path.'middle_no_right.php'), array('theme_path' => $theme_path, 'content' => $content, 'description' => $lang['mailing_mailing']));
  58.  
  59. ?>


Ten post edytował darkowski 12.02.2009, 10:01:21
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 16.10.2025 - 13:02