[BUG] EPiServer.Forms 4.4.4: Emails with placeholders of multiline fields in the subject fails to send

Vote:
 
  • Set up a form with a multiline field.
  • Set up an email to be sent, and set the subject to the placeholder for the multiline field.
  • Fill in the form with multiple lines of text in the field.
  • The email doesn't get sent.

EPiServer.Forms doesn't handle subjects containing linebreaks. They should be removed. .NET fails to set the subject if the string contains a line break.

2017-03-24 12:51:42.456 +01:00 [Error] Failed to send email
System.ArgumentException: The specified string is not in the form required for a subject.
at System.Net.Mail.Message.set_Subject(String value)
at EPiServer.Forms.Implementation.Actors.SendEmailAfterSubmissionActor.SendMessage(EmailTemplateActorModel emailConfig)
System.ArgumentException: The specified string is not in the form required for a subject.
at System.Net.Mail.Message.set_Subject(String value)
at EPiServer.Forms.Implementation.Actors.SendEmailAfterSubmissionActor.SendMessage(EmailTemplateActorModel emailConfig)


#176744
Edited, Mar 24, 2017 12:05
Vote:
 

Thank you, we filed a bug AFORM-695

Though not practical, we will replace \n with <space> or <dot> or <slash>

#176773
Edited, Mar 27, 2017 6:50
Vote:
 
<p>That was our solution too - we had to implement a new&nbsp;SendEmailAfterSubmissionActor overriding the built in one that replaced line-breaks in the subject line.</p>
#176774
Mar 27, 2017 8:47
Vote:
 

What charactor do you replace with?

Subject line of email is one-line only. I still don't think map a multiple-lines field to it make a lot of sense.

#176780
Mar 27, 2017 10:38
Vote:
 

Of course inserting a placeholder for a multiline field in the subject does not make a lot of sense. However it's a feature in EPiServer.Forms that you can do that, so of course an editor will sometimes do it.

We replaced all whitespace(s) in the subject with single spaces like this:

string subject = this._placeHolderService.Service.Replace(emailConfig.Subject, subjectPlaceHolders, false);
subject = Regex.Replace(subject, @"\s+", " ");
#176781
Mar 27, 2017 10:43
Vote:
 

AFORM-695 is DONE with Forms 4.5

#177671
Apr 17, 2017 12:59
Vote:
 
<p>Thank you. We will upgrade, and I will get back to you here if we experience any problems.</p>
#177767
Apr 19, 2017 9:08
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.