Closed markushausammann closed 10 years ago
I just realized that the only thing you need to do is changing:
/**
* {@inheritDoc}
*/
public function send(Message $message)
{
$this->service->send($message);
}
to
/**
* {@inheritDoc}
*/
public function send(Message $message)
{
return $this->service->send($message);
}
in SlmMail\Mail\Transport\HttpTransport.php
. Because the service::send()
method returns the response correctly.
Hi,
Actually the transport implement the TransportInterface and, if I remember correctly, the interface states that it should return "void".
Instead, you should inject the PostmarkService
Yeah, I guess that's better/more correct. I'm closing this but I've got another one already. :)
@bakura10 you are right the transport does not return anything but for example the File
transport holds state of the last sent message. We could do something similar.
public function send(Message $message)
{
$this->response = $this->service->send($message);
}
public function getLastRawResponse()
{
return $this->response;
}
That is similarly named to the Http client for the last sent request & response. That way all SlmMail transports can be used to fetch the transport's send() response too while adhering to the zf2 transport interface.
I'm still not happy with this. If you want to be able to swap transports (injecting with Interfaces only) you should be able to get to the API response via Transport. Do you get my point, do you have an idea how to solve this?
Actually, re-reading @juriansluiman 's last post I see that that would indeed be the way to go. I'll provide a pull request for that.
See respective pull request here: https://github.com/juriansluiman/SlmMail/pull/82
Closing, as discussion continued (and closed) in #82
I just sent a few first messages with the Postmark service and it works. I'm a bit disapointed that the
transport::send()
method doesn't return the API response.The Postmark API responds like this:
The
MessageID
is very helpful for direct bounce tracking. Is there a reason why you don't preserve the API response?