Creating a Shipment with Email Notifications

UPS

Example:

<?php
$shipment = new \RocketShipIt\Shipment('UPS');

$shipment->setParameter('toCompany', 'John Doe');
$shipment->setParameter('toPhone', '1231231234');
$shipment->setParameter('toAddr1', '111 W Legion');
$shipment->setParameter('toCity', 'Whitehall');
$shipment->setParameter('toState', 'MT');
$shipment->setParameter('toCode', '59759');

// Email notification options
$shipment->setParameter('emailTo','customer@email.com');

// Or add multiple recipients
//$shipment->setParameter('emailTo','customer1@email.com, customer2@email.com');

// Defaults to 6 when emailTo is specified
// 3 - Receiver Return Notification
// 6 - Email Notification
// 7 - Exception Notification only
// 8 - Delivery Notification
$shipment->setParameter('notificationCode', '7');

$package = new \RocketShipIt\Package('UPS');
$package->setParameter('weight', '5');

$shipment->addPackageToShipment($package);

$response = $shipment->submitShipment();

FedEx

Example:

<?php
$shipment = new \RocketShipIt\Shipment('fedex');

$shipment->setParameter('toCompany', 'John Doe');
$shipment->setParameter('toName', 'John Doe');
$shipment->setParameter('toPhone', '1231231234');
$shipment->setParameter('toAddr1', '111 W Legion');
$shipment->setParameter('toCity', 'Whitehall');
$shipment->setParameter('toState', 'MT');
$shipment->setParameter('toCode', '59759');

$shipment->setParameter('length', '5');
$shipment->setParameter('width', '5');
$shipment->setParameter('height', '5');
$shipment->setParameter('weight','5');

$shipment->setParameter('emailMessage', 'my message');
$shipment->setParameter('emailRecipientType', 'RECIPIENT');
$shipment->setParameter('emailTo', 'customer@email.com');
$shipment->setParameter('emailFormat', 'HTML');
$shipment->setParameter('emailLanguage', 'EN');

// Omit to turn off specific notifications
$shipment->setParameter('notifyOnShipment', 'YES');
$shipment->setParameter('notifyOnException', 'YES');
$shipment->setParameter('notifyOnDelivery', 'YES');
$shipment->setParameter('notifyOnTender', 'YES');

$response = $shipment->submitShipment();

USPS

Set the emailTo parameter.

Example:

<?php
$shipment->setParameter('emailTo', 'recipient@email.com');

Parameters

notificationCode

  • 3 - Receiver Return Notification
  • 6 - Email Notification
  • 7 - Exception Notification only
  • 8 - Delivery Notification