We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Email Tool (or maybe RegexReplace) Inserting Random Spaces

Mike_Olson
7 - Meteor

I have an Alteryx workflow I'm running on the gallery that sends an email; occasionally the email will have random spaces in it which causes weird formatting due to bad HTML tags, or just random spaces in words.  It isn't consistent when this shows up, and the majority of the time there are no errors.  Is this a known issue?

 

I am generating a string for the body, Email_Body like so:

regex_replace("Your recent [... lots of string formulas, text and line breaks here ...]","\n","<br />")

 

And then in the email tool using the field Email_Body for the Body.

 

It will occasionally insert random spaces in the email HTML like so: ...Option: None</span><b r=""><br><span>...  See the space in <b r="">; this causes the remainder of the email to be bold formatted.

 

Other times there will be a space in the middle of a word: "Netwo rk: "

Other times there is a space in the span tag causing the remainder of the email to be strikethrough: </span><br><s pan="">Request 

 

Has anyone else ever encountered this?  Is there a way to keep this from happening?

 

7 REPLIES 7
n8rushton
Alteryx Alumni (Retired)

I think your regex may be a little off. I would suggest (\r\n|\r|\n)

And despite my love for reg, you may be able to do this with a normal replace that you literally quote out enter such as replace([target],'

','<br />')

Mike_Olson
7 - Meteor

Thanks.  I've replaced the RegexReplace with Replace as you've suggested.  I'll see if that fixes the issues I've seen.

Mike_Olson
7 - Meteor

So I changed my regex replace to a normal replace("...","<br />") and I'm still randomly getting spaces in the middle of words:  For example:"Option: Vo luntary " is in one email generated recently.

 

"Voluntary" is a text field passed through from a list input where the value is "Voluntary" without a space.  So that space is randomly getting inserted somewhere by the email tool.  I think this might be a bug?  The weird thing is that it is inconsistent and not replicable.

n8rushton
Alteryx Alumni (Retired)

Would you mind sending the string going through the email if its not sensitive? I can try to take a look.
Likewise, I had a thought that perhaps you would need to send the flow through a HTML passthrough on the text tool and then through a layout.

Mike_Olson
7 - Meteor

I added a test step to output the strings to an Excel file when I send the data to the email tool (after the replace function), and the space is not there in the string data.  It is being added by the email tool.

I think it has something to do with the string length, as I've run a few more tests generating some long strings and passing them through to the email tool, and looking at the HTML source for the emails it is consistently happening around 1200 characters into the email.

See the attached workflow example, with a text file showing the string, but it won't let me attach the generated HTML email file with the space, but the space is inserted here: "Cras vel mol estie mi."

n8rushton
Alteryx Alumni (Retired)

I ran it through the Text tool like I had thought, it seems to be working...let me know.

Mike_Olson
7 - Meteor

Thanks, that seems to be working.  No spaces in the email.  I still don't get why the other way is introducing spaces, but I'll incorporate this and hopefully that should fix it.

Labels
Top Solution Authors