0

I started a daily deals website and now I want to run mail newsletter. Everything works fine, but now I want to proccess bounce emails (only the inactive ones).

Can someone give me an example cron-script that opens the bounce email box, detect only inactive emails and truncate the inbox?

This is my example script for the newsletter:
$result = mysql_query("SELECT email FROM members");
while($row = mysql_fetch_array($result)) {
    $email = $row["email"];

    $subject = 'Subject of Newsletter';

    $headers = "From: noreply@***.com\r\n";
    $headers = "Return-Path: bounce@***.com\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=UTF-8\r\n";

    $content = 'HTML Newsletter';

    mail($email, $subject, $content, $headers);
}
Kevin Reid
  • 37,492
  • 13
  • 80
  • 108
  • dont use CRON to process your bounces, as this script will have to run regularly (ie when not required). Use a script that will process emails as they arrive. Darn @Vineet1982 for being too quick! – Waygood Feb 27 '13 at 10:05

4 Answers4

1

You'll need to configure whichever mail transport agent handles (MTA) "bounce_handle@domain.com" to send the mail to the PHP script that does whatever magic you need it to do. The MTA is what actually handles mail coming into the server. There are many different MTA's, but most of them have some configuration where you can basically tell it to pipe email coming into a certain address into a custom script.

Alternatively, you could setup a mailbox for your bounce handler and have PHP read it via POP3. For this, you'd have to configure an actual email account for your bounce handler. Then you have your PHP script connect to that mailbox using standard protocols. See the php.net documentation on IMAP/POP for how this is accomplished.

Vineet1982
  • 7,730
  • 4
  • 32
  • 67
0

To avoid bounce pl try with PHPMailer scripts

kapil
  • 162
  • 5
0

Please check the below link you may find some thing useful.

http://www.boogietools.com/Products/Linux/

Sagar Kadam
  • 487
  • 1
  • 3
  • 10
0

I have found a solution: "Process email bounces with PHP" -> http://cheesefather.com/?p=163