Open tomika opened 3 years ago
Yes, you are supposed to pass escaped body
May I ask you, if it is intentional and will remain in future versions? And it is true for every string parameter in the api, ie: Subject and/or Property values?
I am keeping this close to original api and not changing that. I can probably add helper functions to ease this.
This is true for subject field as well as any property you are adding string with special characters
I haven't used the .NET version of this API, but I can hardly beleive that you have to xml escape all string parameters you pass to functions.
@tomika, rather agree with you that it would be convenient if xml-escaping would be part of the module. Meanwhile I use the following code to escape subject field.
const encode = (str) => str
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
Following code : const message = new EmailMessage(service); message.Subject = "Subject"; message.Body = new MessageBody(BodyType.Text, "
Hello"); message.ToRecipients.Add("a@b.com"); message.SendAndSaveCopy(); results e-mail with empty body. The reason is: the program doesn't escapes the body text when sending in soap message. As I saw there is some other issues open in connection with string parameters unescaped, maybe the reason is the same. Is it by design that the user of the library has to pass string parameters xml encoded?