PDA

View Full Version : How to strip slashes in generated e-mail?


Martin
05-23-2009, 11:53 AM
Hi there,

I was wondering if you had a tutorial or a how to strip slashes from the generated e-mails using UE 3.05?

It is very annoying to have a nicely created e-mail and then see slashes breaking apart words.

Is there a specific way to do it with UE?

Thanks!

Martin

Ray Borduin
05-26-2009, 09:01 AM
What server language? Where are they occurring? You can probably add a stripslashes() function where applicable to strip slashes.

Martin
05-27-2009, 07:32 AM
Hi Ray,

I am using PHP, the slashes are showing up in the final sent e-mail.

So how would I apply a function to the UE scripts in order to stripslashes and to prevent words like

your's from showing up like your\s

which can look very unprofessional. Also would this not apply if I was capturing the generated e-mail to a database?

Thanks,

Martin

Ray Borduin
05-27-2009, 07:42 AM
I assume you are getting the value from a form.

Just wherever you refer to a value in your body like:

<?php echo($somecodehere); ?>

instead use:

<?php echo(stripslashes($somecodehere)); ?>

Martin
05-27-2009, 07:52 AM
Hi Ray,

Ok, so I follow you. So the code generated by UE is for example

<?php echo ((isset($_POST["studentName"]))?$_POST["studentName"]:"")?>

So I would then change it to look like this ?

<?php echo (stripslashes((isset($_POST["studentName"]))?$_POST["studentName"]:""))?>

Is this correct?

Would this be a nice feature addition to the body tab in UE?

Thanks again!

Martin

Ray Borduin
05-27-2009, 08:10 AM
You could probably just turn off magicQuotesGPC on the server as well. That is what is adding the slashes.

Martin
05-27-2009, 08:16 AM
Sorry I do not have that kind of access to the server settings. So I have to code it myself.

Did that code look correct to you?

<?php echo (stripslashes((isset($_POST["studentName"]))?$_POST["studentName"]:""))?>

As I mentioned, having UE add the stripslashes would be a nice feature addition =)

Thanks again,

Martin