close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Removing parts of email body

Thread began 7/06/2011 12:12 am by julie383376 | Last modified 8/11/2011 12:46 pm by Jason Byrnes | 3172 views | 11 replies |

julie383376

Removing parts of email body

I don't know if I should post this in UE or DA, and I really don't know what I'm doing, so I can't even figure out what to search for to find my answer in the forum!

The problem is not with UE or DA working incorrectly, it's with me not knowing how to get the results I want...

I have set up logging on my form, and I have used the DA wizard to create results, detail, etc. pages. I need to remove some of the result information that displays for the Email Body field on the Detail page.

It begins with:

--WAMULTIBREAKWA Content-Type: text/plain Content-Transfer-Encoding: 8bit

Then it shows all content that is emailed but without formatting - all in a long paragraph - and ends with

--WAMULTIBREAKWA Content-Type: text/html

Then it shows the exact email that is sent - formatting and all - and ends with:

--WAMULTIBREAKWA--

I just need the data that was entered on the form... Am I going about this the wrong way?

I'm attaching a screenshot to better explain what I am getting and what I want.

Thanks for your help & patience!

~J

Sign in to reply to this post

YellowCircleWeb

Hi Julie,

You should be able to edit the information entered into the email body through the UE extension. Have you built the form using Form Builder or did you develop it yourself and then use the universal email extension?

The getting started guide for UE should explain how to do this: universal-email_gsg.php

Hope this helps you

Sign in to reply to this post

julie383376

First a disclaimer - I've used UE a lot, but never had to do anything more than send an email... I know very little about PHP, and what I do, I've learned from troubleshooting WA scripts ;)

I built the form myself a few months ago and used UE for emailing functionality only. In UE, I created a custom email reply form.

My customer just recently wanted to add this logging feature, so I used the existing UE binding to enable logging.

When I set up logging, I had to use the Create Email Message help file because the GSG gives *very* little information on the logging feature.

I first let the wizard create the table for me, then I went back in and changed the logging to insert a record on failure or success.

"Email Column" is tied to the EmailTo field.

In the large Field Values box, I clicked on each column field (except for EmailID and EmailDate) and clicked the lightning bolt to do the binding for each, matching them to the field displayed in [Current Email]. Those were:

Email To [To]
EmailFrom [From]
EmailSubject [Subject]
EmailBody [Body]
EmailHeader [Header]
EmailError [Error]
EmailStatus [Status]

I didn't make a selection in the Format dropdown list, because I don't have a clue what that is.

----------

So am I including too much information? Was I supposed to only bind the EmailTo field?
Or am I doing this all wrong?

My emails are sending, and the data is collecting just fine. I just can't get the DA detail page to display the information the way I want it to appear. In the email body part, I only want the data that was entered in the online form. At some point if an email fails, my customer may want to be able to view the header, so I'm okay with all the information that is displayed for that field.

Sign in to reply to this post

Jason ByrnesWebAssist

Ian H,

This is the email body that is being stored in the database by the email logging.


julie,

If all you want in the database is the dynamic form input, add the following at line 1 of your page:

php:
<?php 

if (($_SERVER["REQUEST_METHOD"] == "POST"))     {
    @
session_start();
    
$_SESSION['mailBody'] = "";
    foreach( 
$_POST as $pkey => $pval ){
        
$_SESSION['mailBody'] .= "".str_replace("_"," ",$pkey).": ".str_replace("\n","<BR />",(is_array($pval)?implode(", ",$pval):$pval))."<br />";
    }
}
?>




then go to the bindings panel, click the plus button and select Session Variable and name it "mailBody"


edit the universal Email instance, and go to the logging section. For the mail body column, click the lightning bolt next to value and select the mailBody session variable from the dynamic bindings.

Sign in to reply to this post

julie383376

Wow... that looks WAY better!

Is it possible to change the way the new mailbody information looks? I want the results to be pretty ;)

Specifically, what I want to do is remove my captcha stuff at the end, and remove the field names (or make them invisible). Currently these are the last three lines of what I get:

comments: test
captcha x: 164
captcha y: 74

Now, just in case it matters, I didn't change anything on my DA pages, but they work fine, so I must not have needed to! I'm attaching a screenshot of new results.

Sign in to reply to this post

Jason ByrnesWebAssist

sure, change the code at line 1 to:

php:
<?php 

if (($_SERVER["REQUEST_METHOD"] == "POST"))     {
    @
session_start();
    
$removeArray = array();
    
$removeArray[] = "captcha_x";
    
$removeArray[] = "captcha_y";
    
$_SESSION['mailBody'] = "";
    foreach(
$_POST as $pkey => $pval ){
        if(!
in_array($pkey,$removeArray)) {
            
$_SESSION['mailBody'] .= "".str_replace("\n","<BR />",(is_array($pval)?implode(", ",$pval):$pval))."<br />";
        }
    }
}
?>
Sign in to reply to this post

julie383376

You rock, Jason!

Thanks!

~J

Sign in to reply to this post

Jason ByrnesWebAssist

no worries.

Sign in to reply to this post

Nathan69474

Hi Jason,

I've a quirky add-on question ... I'm trying to do the same only with the Security Question / Answer rather then cachup

<?php
if (($_SERVER["REQUEST_METHOD"] == "POST")) {
@session_start();
$removeArray = array();
$removeArray[] = "Security_Answer";
$removeArray[] = "captcha_x"; // I've tried removing this, but still get the numbers
$removeArray[] = "captcha_y"; // as above
$_SESSION['mailBody'] = "";
foreach($_POST as $pkey => $pval ){
if(!in_array($pkey,$removeArray)) {
$_SESSION['mailBody'] .= "".str_replace("\n","<BR />",(is_array($pval)?implode(", ",$pval):$pval))."<br />";
}
}
}
?>

The security answer correctly removes itself as does the field arrays but in the db I get an additional eg ... <br />33<br />4<br /> ... at the bottom of the db entry.

I've tested it 4 or 5 times and the 33's and 4's range from 33/35/38/39 or 4/11/12. There doesn't seem to a pattern to the numbers. The db entries numbers are 14-20 so it's not the emailID numbers, I've also compared it to the mins / seconds / date etc but again no pattern.

I'm guessing I need to add a couple of extra removes ... eg...
... $removeArray[] = "global_form_field_names";

It's only a basic form.
this is a typical full db entry (I've replace the form content inputs with the db field names)

contact name field<br />
email field<br />
phone number field<br />
company name field<br />
enquiry details field (followed by extra numbers)<br /><br />33<br />12<br />

It's not the most crucial of tidying ups but it would be nice to get id of the extra numbers.

Thanks
nathan

Sign in to reply to this post

Jason ByrnesWebAssist

send a copy of the page in a zip archive please.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...