Richmail and apostrophes

Richmail and apostrophes


I'm using the Richmail extension to generate and send emails in an application when certain events occur. The RichMailCreate action is used to create the contents of the email, but I am experiencing a problem when the 'To' email address contains an apostrophe.

If the email address contains no apostrophe - for example, when I audit the email message I am seeing something like this:
To: <>

However if the email address was something like k.o', then the audit message would be like this:
To: =?iso-8859-1?Q?k.o?='< uk>
and the message is undelivered.

I have tried escaping the apostrophe in the email address (\') and inserting it twice ('') but neither fix the issue.

Can anyone tell help with a workaround or fix?

Many thanks
Hi Keith,

You are right, that is indeed an issue with the richmail extension that will be corrected in a future version.

For now a possible workaround is to assign RichMailCreate.Mail to a variable and post-process it before using that variable in the Mail argument of the RichMailSend action. You can use regular expression functions of the Text extension to do this.

If I was not clear enough or if you need further assistance with this please let me know.

Tiago Simões
As a workaround, you can do the following:
1. Join all emails (To, CC, BCC, From) in a single string;
2. Replace all single quote characters with a special token (e.g. MYQUOTESMY);
3. Create your email using RichMailCreate;
4. Replace all entries of MYQUOTESMY with the ' character.
5. Feed the changed string to RichMailSend.

You can use the internal function replace to perform the steps in 2 and 4.

If you have doubts with this, please reply here.

I have already forwarded this situation to OutSystems Support, because in fact ' are accepted as part of an email address.

thanks for the responses and the workaround suggestions. It's now sending the emails as expected :)