First order email is sent to "umbracoATgruppoeidosDOTit", second order is sent to "umbracoATgruppoeidosDOTit" and "umbracoATgruppoeidosDOTit", and so on.
I am running into this exact same problem. One thing I've noticed is that when the application is restarted it gets 'reset' back to just the one (or more) that were set in the back office.
You can also check by looking at the record in the table .merchNotificationMessage. (I was confused at first, because I must have saved the additional recipients at one point.) FYI, I'm running Merchello 1.5 which I've forked. Any work-arounds appreciated!
This sounds like a caching issue that I thought had been patched. I'll take another look and get it patched up for the 1.7.0 release which will be out by Tuesday at the latest.
Thanks Rusty. Not sure why, but this.RebuildCache() did not work for me but I was able to add some code that copied the list of recipients to a variable and then add it back. It's hacky, but we are going live very, very soon, and I needed to resolve this (and I had already forked Merchello core). Thanks again Rusty for helping me out!
Most people should wait for 1.7.0, but here's the code from the OnNext method of the OrderConfirmationMonitor class with my hack:
foreach (var message in Messages)
{
string originalRecipients = message.Recipients; // hack
if (value.Contacts.Any() && message.SendToCustomer)
{
// add the additional contacts to the recipients list
if (!message.Recipients.EndsWith(";"))
message.Recipients += ";";
if (message.Recipients[0] == ';')
message.Recipients = message.Recipients.TrimStart(';');
message.Recipients = string.Format("{0}{1}", message.Recipients, string.Join(";", value.Contacts));
}
// send the message
NotificationContext.Send(message, formatter);
message.Recipients = originalRecipients; // hack
}
The fix in 1.7.0 works well and is proved in several integration tests.
I've added an extension method to INotificationMessage
/// <summary>
/// Performs a member wise clone of a notification message
/// </summary>
/// <param name="message">
/// The message to be cloned.
/// </param>
/// <returns>
/// The <see cref="INotificationMessage"/>.
/// </returns>
public static INotificationMessage MemberwiseClone(this INotificationMessage message)
{
////http://issues.merchello.com/youtrack/issue/M-591
return new NotificationMessage(message.MethodKey, message.Name, message.FromAddress)
{
Key = message.Key,
BodyText = message.BodyText,
Recipients = message.Recipients,
BodyTextIsFilePath = message.BodyTextIsFilePath,
Description = message.Description,
Disabled = message.Disabled,
MaxLength = message.MaxLength,
MonitorKey = message.MonitorKey,
ReplyTo = message.ReplyTo,
SendToCustomer = message.SendToCustomer,
CreateDate = message.CreateDate,
UpdateDate = message.UpdateDate
};
}
and then used return a member wise clone of the message from Messages property of Merchello.Core.Gateways.Notification.Monitors.NotificationMonitorBase
/// <summary>
/// Gets the cached collection of <see cref="INotificationMessage"/>
/// </summary>
protected IEnumerable<INotificationMessage> Messages
{
get
{
////http://issues.merchello.com/youtrack/issue/M-591
return _messages.Value.Select(x => x.MemberwiseClone());
}
}
Receiver Email replicated
The "order confirmation" email is sent to all customer email of all order (before the site is restarted)
I simplified my checkout code in:
First order email is sent to "umbracoATgruppoeidosDOTit", second order is sent to "umbracoATgruppoeidosDOTit" and "umbracoATgruppoeidosDOTit", and so on.
Where is wrong?
Thanks!
I am running into this exact same problem. One thing I've noticed is that when the application is restarted it gets 'reset' back to just the one (or more) that were set in the back office. You can also check by looking at the record in the table .merchNotificationMessage. (I was confused at first, because I must have saved the additional recipients at one point.) FYI, I'm running Merchello 1.5 which I've forked. Any work-arounds appreciated!
Alex
This sounds like a caching issue that I thought had been patched. I'll take another look and get it patched up for the 1.7.0 release which will be out by Tuesday at the latest.
Alex,
If you are working on a Merchello Fork try adding
as the first line in the OrderConfirmationMonitor class's OnNext method.
This definitely has not been fixed so a better solution will be included in 1.7.0 next week.
Thanks Rusty. Not sure why, but this.RebuildCache() did not work for me but I was able to add some code that copied the list of recipients to a variable and then add it back. It's hacky, but we are going live very, very soon, and I needed to resolve this (and I had already forked Merchello core). Thanks again Rusty for helping me out!
Most people should wait for 1.7.0, but here's the code from the OnNext method of the OrderConfirmationMonitor class with my hack:
Alex,
The fix in 1.7.0 works well and is proved in several integration tests.
I've added an extension method to INotificationMessage
and then used return a member wise clone of the message from Messages property of Merchello.Core.Gateways.Notification.Monitors.NotificationMonitorBase
is working on a reply...