Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: PHP Mailer - sprawdzanie domen
Forum PHP.pl > Forum > PHP
mekeke
Witam,
Skorzystałem z bibliotek SMTP MAilera - podłączyłemn do bazy danych do wysyłki meili. Mam problem taki, że system sprawdza czy domena istnieje - jak tak wysyła dalej, jak nie wywala błąd:
Mailer Error: SMTP Error: The following recipients failed: adres@emial.pl
SMTP server error: 4.1.2 : Recipient address rejected: Domain not found


Jak napisać instrukcje która by to ignowrowała - chyba że PHP mailer ma możliwość wyłączenia tego?

Pozdrawiam
Turson
Pokaż kod, który napisałeś. Ostatnio używałem PHPMailera, który wysyłał mi maile na nieistniejące adresy i błędów nie było.
mekeke
  1. <?php
  2. ini_set('display_errors', 1);
  3. error_reporting(E_ERROR & E_WARNING);
  4. mb_internal_encoding("UTF-8");
  5. header('Content-type: text/html; charset=utf-8');
  6. $body = file_get_contents('contents.html');
  7. $body = eregi_replace("[\]",'',$body);
  8. require_once('class.phpmailer.php');
  9. $db = mysql_connect('', '', '') or die('Nie można się poł?czyć: ' . mysql_error());
  10. mysql_select_db('96_client') or die ('Nie mozna wybrać bazy danych');
  11. mysql_query('SET NAMES "utf8";');
  12. if(!isset($_GET['offset'])) $_GET['offset'] = 0;
  13. $limit = '20';
  14. $mails = mysql_query('SELECT `email` FROM `tabela` LIMIT '.$_GET['offset'].', '.$limit.'');
  15. if(mysql_num_rows($mails) == 0) die('Koniec, wysłałem '.$_GET['offset'].' wiadomości.');
  16. $cnt = 0;
  17. while($row = mysql_fetch_assoc($mails)) {
  18. $address = $row['email'];
  19. $mail = new PHPMailer();
  20. $mail->CharSet="UTF-8";
  21. $mail->IsSMTP(); // telling the class to use SMTP
  22. $mail->Host = "mail.xxx.pl"; // SMTP server
  23. $mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
  24. // 1 = errors and messages
  25. // 2 = messages only
  26. $mail->SMTPAuth = true; // enable SMTP authentication
  27. $mail->Host = "host.pl"; // sets the SMTP server
  28. $mail->Port = 587; // set the SMTP port for the GMAIL server
  29. $mail->Username = "adres@mail.pl"; // SMTP account username
  30. $mail->Password = "pa$w00rd"; // SMTP account password
  31. $mail->SetFrom('adres@mail.pl', 'TEMAT');
  32. $mail->AddReplyTo("adres@mail.pl","TEMAT");
  33. $mail->Subject = "TEMAT";
  34. $mail->AltBody = "TEMAT"; // optional, comment out and test
  35. $mail->MsgHTML($body);
  36. $mail->AddAddress($address, $address);
  37. // $mail->AddAttachment("images/phpmailer.gif"); // attachment
  38. // $mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
  39. if(!$mail->Send()) exit("Mailer Error: " . $mail->ErrorInfo);
  40. $cnt++;
  41. $mail = null;
  42. }
  43. echo 'Koniec, wysłałem '.$cnt.' wiadomości.';
  44. ?>
  45. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  46. <html xmlns="http://www.w3.org/1999/xhtml">
  47. <head>
  48. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  49. <meta http-equiv="Refresh" content="4; URL=index.php?offset=<?php echo $_GET['offset']+$limit; ?>" />
  50. <title> newsletter</title>
  51. </head>
  52.  
  53. <body>
  54. Wysyłanie mailingu w trakcie. Do tej pory wysłano <?php echo $_GET['offset']+$limit; ?> wiadomości.
  55. </body>
  56. </html>
Turson
  1. if(!$mail->Send()) exit("Mailer Error: " . $mail->ErrorInfo);

Widzisz to?
mekeke
Widzę smile.gif - jest OK teraz smile.gif Dzięki
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.