Skip to content

netsco/bouncestudio-php-module

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Module for Boogie Tools - BounceStudio

BounceStudio by Boogie Tools is a paid for library for handling your bounce emails - see http://www.boogietools.com/ for more details.

Pre-built Binaries

Pre-built .so files for PHP 8.4 and 8.5 on Debian and Ubuntu are available from GitHub Releases.

Installing BounceStudio

First we need to make sure the BounceStudio library is installed and ready to use

  • Copy BounceStudio.h header file to /usr/local/include
  • Copy libBounceStudio64.so.3.x.x.x shared object file to /usr/local/lib
  • Create symbolic link to lib file ln -s /usr/local/lib/libBounceStudio64.so.3.x.x.x /usr/local/lib/libBounceStudio64.so
  • Create conf file echo /usr/local/lib > /etc/ld.so.conf.d/BounceStudio.conf
  • Run ldconfig to setup the library

Building the PHP Module

In the src/ directory run:

phpize
./configure --enable-bouncestudio
make CFLAGS="-lBounceStudio64 $CFLAGS"
make install

If your system has multiple PHP versions, use the version-specific phpize (e.g. phpize8.4, phpize8.5).

Find your PHP conf directory

php -i|grep "^Scan this dir for additional .*$"|grep -oh '/etc.*$'

Create the ini file

echo 'extension=bouncestudio.so' > /path/to/modules/20-bouncestudio.ini

Usage

$license = "Test User/123456789";
$message = "Date: Fri, 14 Nov 2003 14:00:01 -0500
Message-ID: <AauNjVuMhvq0000007c@elsewhere.com>
From: \"Mr. PostMaster\" <postmaster@elsewhere.com>
Reply-To: \"My Reply Account\" <postmaster_reply@elsewhere.com>
Subject: Failure Notice
To: \"Mrs. Someone\" <someone@somewhere.com>

Hi. This is the mail transport agent at mail.elsewhere.com.
I'm afraid I wasn't able to deliver your message to the
following addresses.  This is a permanent error; I've
given up. If you have questions about this notice, please
forward it to postmaster@elsewhere.com along with your
comments.

<john@smith.com>:
Sorry, this account has been deactivated. (#5.2.1)

--- Below this line is a copy of the message.

Return-Path: <someone@somewhere.com>

From: \"Mrs. Someone\" <someone@somewhere.com>
Reply-To: \"Mrs. Someone\" <someone_reply@somewhere.com>
To: \"John Smith\" <dave@smith.com>
Date: Mon, 21 Aug 00 13:50:20 -0700
Subject: JOE.NET NEWS!
MIME-Version: 1.0
Message-ID: <agW2wx6Di110f7@somewhere.com>

This is a multi-part message in MIME format.

etc.
etc.
etc..";
$ignoreAddresses = 'noreply@mizmoz.net|you@example.com';

$bounceStudio = new BounceStudio($license, $message, $ignoreAddresses);

// Get the bounce code
// @see http://www.boogietools.com/Products/Linux/BounceStudioAPI/Email-Bounce-Boogie-Bounce-API-Categories.asp
$code = $bounceStudio->getBounceCode();

// Get the bounced email address
$bounceEmail = $bounceStudio->getBounceEmail();

// Get the message body
$body = $bounceStudio->getBody();

// Get the email headers as a string
$headers = $bounceStudio->getHeaders();

// Get a specific header from the bounce email
$date = $bounceStudio->getHeader('date');

// Get a specific header from the original email
$messageId = $bounceStudio->getOriginalHeader('message-id');

// Get the from email address
$fromEmail = $bounceStudio->getFromAddress();

// Get the from name
$fromName = $bounceStudio->getFromName();

// Get the to email address
$toEmail = $bounceStudio->getToAddress();

// Get the to name
$toName = $bounceStudio->getToName();

// Get the reply-to email address
$replyToEmail = $bounceStudio->getReplyToAddress();

// Get the reply-to name
$replyToName = $bounceStudio->getReplyToName();

// Get the subject
$subject = $bounceStudio->getSubject();

About

PHP 7 Module for Boogie Tools - BounceStudio

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • C 83.9%
  • PHP 13.1%
  • M4 2.2%
  • Shell 0.8%