Service is API client implementation. Does not correspond with any Zend\Mail transport interface. The HTTP transport class is an impl. of the Transport interface, accepting any of the SlmMail API client services. Actually, the SlmMail transport is a bridge between Zend Mail and all supported API service.
- Use the transport if you have previously have used Zend\Mail. It enables you to simply swap the Sendmail / SMTP transport and switch instantly to a 3rd party mail service
- Use the services if you only need the service implementation and have no need to further utilize Zend\Mail features
use SlmMail\Service\MailgunService;
use Zend\Mail\Message;
$config = ['domain' => 'my_domain', 'key' => 'asd123'];
$service = new MailgunService($config['domain'], $config['key']);
$message = new Message;
$message->setSubject('Hi there');
$result = $service->send($message);
var_dump($result);
use SlmMail\Service\MailgunService;
use SlmMail\Mail\Transport\HttpTransport;
use Zend\Mail\Message;
$config = ['domain' => 'my_domain', 'key' => 'asd123'];
$service = new MailgunService($config['domain'], $config['key']);
$transport = new HttpTransport($service);
$message = new Message;
$message->setSubject('Hi there');
// Here you had previously a SMTP transport or Sendmail transport
// Now it is swapped with the Mailgun transport but the consumer code
// (this $transport->send()) is unaltered
$transport->send($message);