-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Headers are not passed to Postal Message #8
Comments
You're right, the headers don't get passed to Postal, they are just the only way I could think of for getting those two pieces of information into the transport class for creating log entries in our applications. Our use of Postal has only been as a sending platform, we don't really log into it to analyse the messages going out for example. We tend to make extensive use of logging within our individual applications so its a better fit for us there. Do you add additional custom headers to your |
Ah, I actually thought that sending the custom headers is required for matching the webhook response to the actual model, but it seems that these header fields were not intended for that purpose. Still it would be nice to send custom headers I think. Again, two solutions: The official transport classes for Mailgun and SES send the raw message instead using a JSON format. The other solution would be something along the lines of <?php
private function swiftToPostal(Swift_Mime_SimpleMessage $swiftmessage) : SendMessage
{
if ($message->getHeaders()) {
$headers = $message->getHeaders()->getAll();
foreach( $headers as $header) {
if( $header instanceof Swift_Mime_Headers_UnstructuredHeader ) {
$postalmessage->header($header->getFieldName(), $header->getValue());
}
}
}
// ...
} |
The best solution here is to switch to using the Unfortunately this would prevent us from being able to implement #9 as that endpoint does not accept the |
I've stumbled across this post while searching for a solution why my |
I believe that the code is more flexible than it was when this issue was first created so it is possible there may be a solution but as my esteemed colleague noted, the best solution is to use the raw endpoint directly rather than trying to parse the headers and decide which ones are actually custom. You could use an SMTP connection to Postal to achieve this as well. |
Alright, thanks! When using an SMTP connection, can i still use the webhook ability from your library? I guess so, right? |
you could but you might struggle to identify which message the webhook relates to as using SMTP means you probably don't know the ID of the message |
Hey,
maybe I setup something wrong, but with the
logEmailAgainstModel
method set and the'postal.enable.emaillogging'
value set to true I do not get thenotifiable_class
andnotifiable_id
headers passed to Postal.On inspection they do get set on the underlying
Swift_Message
instance, but get lost during the transformation to a Postal message. If I understood the code correctly theswiftToPostal
method of thePostalTransportClass
simply does not set any custom headers.This does not only break the email logging feature, but also does not allow the application to pass any additional headers, which could break some workflows.
The text was updated successfully, but these errors were encountered: