View Full Version : Line Returns Missing from Received Email
patch.work177889
08-08-2009, 12:25 PM
I've set up a form for our club officers to email all active members using UE 3.0.6 & a MySQL record set. So far, everything seems to be working fine EXCEPT any returns entered into the form do not show up. I have all charsets to UTF-8. I've tried other charsets, but same problem. Of course, if I enter BR tags into the form, those will work.
I've noticed other threads discuss a solution by changing lines in the mail_PHP.php file:
$lineEnd = "\r\n";
and change it to:
$lineEnd = "\n";
It seems that this might address my issue, but before I start mucking about inside the WA files, I thought there might be a different solution. Attached is my php page with the email form & UE server behavior along with the UE files.
thanks,
rob welles
Eric Mittman
08-10-2009, 11:14 AM
If you are apprehensive about altering the code in the file you can make a backup of the file first, then just make an update to the line. This should be a very simple update that needs to only be performed in one place. Please try this out and if you have any issues post back and let us know.
Ray Borduin
08-10-2009, 11:27 AM
try using str_replace("\\n","<br>",$_POST['field']);
That should replace return key with BR tags so that they will show up in html and in the email.
patch.work177889
08-10-2009, 12:32 PM
Ray,
Where would the code snippet be placed? Inside the body tab of UE?
Ray Borduin
08-11-2009, 07:33 AM
Yes, wherever you are referring to a value that you want line breaks to appear as <br> tags. In this case that is in the body of the universal email.
patch.work177889
08-12-2009, 06:30 PM
Ray,
I sure appreciate your help on this!! However, I'm not quite there yet... When I use the dynamic button (in the Edit Mode of the Body Tab) to select the form field, the following code gets inserted:
<?php echo((isset($_POST["body"]))?$_POST["body"]:"") ?>
I tried:
<?php echo(str_replace("\\n","<br>",$_POST['body'])); ?>
and
<?php echo((isset($_POST["body"]))?str_replace("\\n","<br>",$_POST['body']):"") ?>
In both cases, the text shows up but not any returns.
Any suggestions?
thanks,
rob
Ray Borduin
08-13-2009, 07:17 AM
Sorry... my mistake... it should only have one backslash.... other than that both would probably work.
<?php echo(str_replace("\n","<br>",$_POST['body'])); ?>
patch.work177889
08-13-2009, 05:53 PM
Ray - Thanks for the quick lesson in using str_replace! Everything is working perfectly!!
info72555
09-16-2009, 05:50 PM
I don't know anything about programming and get easily frustrated. I have attempted to follow your instructions and assume I am making a really dumb mistake.
Where exactly do you place the String Replace line you mentioned? Do I still need to remove the "\r"? There are 2 lines with "\r\n" but you are suggesting to only change one?
I opened the WAUE file and assume I need to make a change to the following section:
//Start Mail Body
$MailBody = $MailBody . "";
foreach( $_POST as $pkey => $pval ) {
$MailBody = $MailBody . "\r\n";
$MailBody = $MailBody . (str_replace("_"," ",$pkey).": ".($pval));
$MailBody = $MailBody . "\r\n";
}
$MailBody = $MailBody . "";
//End Mail Body
What do I do to get the line breaks in the output?
Please help.. I am about to lose my mind!!
info72555
09-17-2009, 06:57 AM
I had previously purchased the Contact Form Solution Pack and I am now recycling a template. All the formatting is done in this template and style sheets can be applied as well.
Works great!
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.