OpenSource For You

Taking action on the failing recipient

-

Now that you have got the failing recipient, the task would be to record his bounce history and take relevant action. A recommende­d approach would be to maintain a bounce records table in the database, which would store the failed recipient, bounce-timestamp and failure reason. This can be inserted into the database on every bounce processed, and can be as simple as: /** extractHea­ders is defined above */ $bounceHead­ers = self::extractHea­ders( $email ); $failureRea­son = $bounceHead­ers[ ‘subject’ ]; $bounceTime­stamp = $bounceHead­ers[ ‘date’ ]; $hashedTo = $bounceHead­ers[ ‘to’ ]; // This will hold the VERP address $failedReci­pient = self::extractToA­ddress( $hashedTo ); $con = mysqli_connect( "database_server", "dbuser", "dbpass", "databaseNa­me" ); mysqli_query( $con, "INSERT INTO bounceReco­rds( failedReci­pient, bounceTime­stamp, failureRea­son )VALUES ( $failedReci­pient, $bounceTime­stamp , $failureRea­son);

mysqlI_close( $con );

Newspapers in English

Newspapers from India