-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add attachments support for notifications #7
Comments
Is development on this feature dead? We could really use it with SendGrid without patching the module manually. |
Can you please respond? |
Hello, @j-mok ! We are not planning to add attachments to notifications in the near future because we saw the following problems during the testing phase:
Therefore, we recommend linking the notifications to attachments in e.g. assets. This way the user can access such attachments only after authorization. |
I understand your point of view and am ok with that. Still we need to have those attachments sent and so far we did this by inheriting from We're not happy with the current copy-and-paste approach and instead would like to use some kind of a pre-send hook that would allow us to inject attachments into the message just before invoking SendGrid client. Here's a general concept: public class SendGridEmailNotificationMessageSender : INotificationMessageSender
{
// ...
public virtual async Task SendNotificationAsync(NotificationMessage message)
{
// ...
try
{
var client = new SendGridClient(_sendGridOptions.ApiKey);
var mailMsg = new SendGridMessage
{
From = fromAddress,
Subject = emailNotificationMessage.Subject,
HtmlContent = emailNotificationMessage.Body,
};
// ...
BeforeMessageSend(message, mailMsg);
var response = await client.SendEmailAsync(mailMsg);
// ...
}
catch (SmtpException ex)
{
throw new SentNotificationException(ex);
}
}
protected virtual void BeforeMessageSend(NotificationMessage message, SendGridMessage sendGridMessage)
{
}
} This way we would extend only what we need to extend and avoid the hacky and brittle approach of base method duplication. |
@asvishnyakov commented on Fri Jun 09 2017
PR #645 related to this issue, please review
@eMazeika commented on Wed Apr 10 2019
It was never merged, right?
The text was updated successfully, but these errors were encountered: