Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

RevDotNet errors on send mail

Server is Windows 2016. When we have multiple email addresses in the sendto field we see a RevDotNet failure.
AI(Claude) tells me this is the problem. Other email with a single address in sendto seems to work okay. I have made sure that the string of addresses is separated by commas.

The error is being thrown while parsing an email address string into a System.Net.Mail.MailAddress object. Here's what's happening:
The header in question: Based on the stack trace, SRPMail.Message.StringToAddress(String s) is taking a string and passing it directly into the single-address MailAddress constructor:
at SRPMail.Message.StringToAddress(String s)
at SRPMail.Message..ctor(String message, String body, String licenseText, String licenseHtml)
The comma character it's complaining about is coming from the recipient list shown at the bottom of your log:
kareng@shoesforcrews.com,daisy@shoesforcrews.com,aldof@shoesforcrews.com
Why it fails: System.Net.Mail.MailAddress's constructor (the one used by MailAddressParser.ParseAddress) expects a single email address, not a comma-separated list. When SRPMail.Message.StringToAddress tries to build one MailAddress object out of that whole comma-separated string, the parser reads up to the first comma, then chokes because a comma is not a valid character within a single address/header value — hence "invalid character was found in the mail header: ','".
Likely fix, depending on where you have access to modify this:

If this is in SRPMail's source code, StringToAddress needs to split the string on commas first and construct a MailAddress for each recipient (adding each to a MailAddressCollection, e.g., MailMessage.To.Add(...) per address), rather than passing the entire multi-address string to a single MailAddress constructor.
If SRPMail is a black-box/compiled library you can't edit, check whether it has a separate method or delimiter convention for multiple recipients (some mail wrapper libraries expect semicolons ; instead of commas, or expect you to call an "AddRecipient" method once per address rather than passing a combined string).


Sign In or Register to comment.