?
Solved

Problem with cfmail response from end-user

Posted on 2003-03-27
6
Medium Priority
?
252 Views
Last Modified: 2013-12-24
I am working on an employee "vacation request" form, which is currently not using a database.  When the user sends the request, an email is sent to a manager's group mailbox.  The manager then replies to the request using an email form and they get a confirmation pop-up window.  When they submit their response some of the fields are not querying and causing an error.  The odd thing is, it seems to be working fine for some manager's mail clients (all using Outlook 2002), but others are generating an error.  For this reason, I know there must be a setting or update in Outlook that is causing this, but I think there may also be a problem with my code.  I'm new to CF, so there may be other errors or redundancies that do not effect this.  Any help would be greatly appreciated!  This has been driving me crazy!

Here's the initial form code (greatly condensed):.

......
<CFOUTPUT>

<form name="toreq" method="post" action="toreq_out.cfm">

<cfset tod = "email1@domain.com">
<cfset toh = "email2@domain.com">
<cfset tok = "email3@domain.com">
<cfset tot = "email4@domain.com">
<cfset mo=dateformat(now(),"mm")>
<cfset da=dateformat(now(),"dd")>
<cfset yr=dateformat(now(),"yy")>
<cfset hr=timeformat(now(),"HH")>
<cfset mi=timeformat(now(),"mm")>
<cfset se=timeformat(now(),"ss")>

<cfset dateNo=#mo#&#da#&#yr#>
<cfset numNo=#hr#&#mi#&#se#>
<cfset space= "-" >
<cfset formNo=#dateNo#&#space#&#numNo#>

<INPUT type="hidden" name="DN" value = "#dateNo#">
<INPUT type="hidden" name="tod" value = "#tod#">
<INPUT type="hidden" name="toh" value = "#toh#">
<INPUT type="hidden" name="tok" value = "#tok#">
<INPUT type="hidden" name="tot" value = "#tot#">
<INPUT type="hidden" name="FN" value = "#formNo#">
<INPUT type="hidden" name="today" value = "#mo#/#da#/#yr#">
<INPUT type="hidden" name="timenow" value = "#hr#:#mi#">

<input type="text" name="name" size="24">
<input type="text" name="id" size="6">

<select name="center" tabindex="3">
<option value="">---Select---
<option value='DAL'>Dallas
<option value='HOU'>Houston
<option value='KC'>Kansas City
<option value='TUL'>Tulsa
</select>

<input type="text" name="month" maxlength="2" size="2">
<input type="text" name="day" maxlength="2" size="2">
<input type="text" name="year" maxlength="2" size="2">

</form>
</cfoutput>
...



------------------ "toreq_out.cfm" (the second file) -----------------

<cfif #center# eq "DAL">
<cfset to = #tod#>
</cfif>
<cfif #center# eq "HOU">
<cfset to = #toh#>
</cfif>
<cfif #center# eq "KC">
<cfset to = #tok#>
</cfif>
<cfif #center# eq "TUL">
<cfset to = #tot#>
</cfif>

<cfmail from="email@domain.com" to="#to#" type="HTML" subject="#today# #timenow# Time Off Request -- #name# for #month#/#day#/#year#">

<b>REQUEST FOR TIME OFF -- Submitted:&nbsp; #today#&nbsp; Time:&nbsp; #timenow#</b><br>
<hr>
<b>Submitted by:</b> #name#<br>
<br>
<b>Date Requesting:</b> #month#/#day#/#year#<br>

<form action="http:/domain.com/forms/response_toreq.cfm" method="POST" name="send">

<input name="granted" type="radio" value="Approved" checked> APPROVED
<input name="granted" type="radio" value="Denied"> DENIED
Manager: <input type="text" name="manager" size="20">
Date: <input type="text" name="date" size="8">

Reason for Denial: <textarea name="denyreason" rows="2" cols="></textarea>

<input type="submit" name="submit" value="Click here to submit E-Mail response

<INPUT type="hidden" name="to" value = "#to#">
<INPUT type="hidden" name="name" value = "#name#">
<INPUT type="hidden" name="id" value = "#id#">
<INPUT type="hidden" name="center" value = "#center#">
<INPUT type="hidden" name="month" value = "#month#">
<INPUT type="hidden" name="day" value = "#day#">
<INPUT type="hidden" name="year" value = "#year#">
<INPUT type="hidden" name="DN" value = "#DN#">
<INPUT type="hidden" name="today" value = "#today#">
<INPUT type="hidden" name="timenow" value = "#timenow#">

</form>
</cfmail>
......


------------------ "response_toreq.cfm" (the third file) -----------------

.....

<cfmail from="#to#" to="#to#;#id#@domain.com" type="HTML" subject="#today# #timenow# Time Off Request #granted# -- #name# for #month#/#day#/#year#">
Response to Request for Time Off<br>
Request originally sent #today# at #timenow#:
<hr>
<b>Date Requesting:</b>&nbsp;&nbsp; #month#/#day#/#year#<br>
<br><br>
<b>Your request has been #granted#.<br>
<b>Manager:</b>&nbsp;&nbsp; #manager#<br>
<b>Date:</b>&nbsp;&nbsp; #date#<br>
<br>
<b>Reason for Denial (if applicable):</b>&nbsp;&nbsp; #denyreason#</font>
</cfmail>

<cfoutput>
<br><br>
<center>
<font size="6">Your reponse has been sent.</font>
<hr>
<font size="4">A copy of this response will be sent to your group mailbox.<p>
You may close this window.</font>
</center>
</cfoutput>
......

------------------------------------------------------------------

That's it in a nutshell.  Again, all I'm really concerned with is getting the bottom output to generate when the manager submits their response.  On some of their email applications it gives an error while evaluating the expression:  #manager# neq "" and #date# neq "".  Any help would be greatly appreciated!!
0
Comment
Question by:mbogert
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 2

Expert Comment

by:dlewis9
ID: 8220965
This is an interesting topic...here's what I've found so far..

When using Outlook Express, you can submit forms from email just fine..

When using Outlook, 2 page requests are sent..one as a POST with the form variables, and one as a plain GET without the form variables.  You see a Cold Fusion error because the form variables are not being sent on the second request.  The first request is either done behind the scenes, or is immediately replaced with the second request so you never see it.

This was tested on Win XP Pro with Office XP....

I'm still looking, but wanted to post that!  Looks like an Outlook bug to me..?
0
 
LVL 8

Expert Comment

by:TallerMike
ID: 8221021
A few things:

First, start using CFSCRIPT when you are setting 3 or more values in a row:

<cfscript>
    tod = "email1@domain.com";
    toh = "email2@domain.com";
    tok = "email3@domain.com";
    tot = "email4@domain.com";
    mo=dateformat(now(),"mm");
    da=dateformat(now(),"dd");
    yr=dateformat(now(),"yy");
    hr=timeformat(now(),"HH");
    mi=timeformat(now(),"mm");
    se=timeformat(now(),"ss");
</cfscript>

Second, start using CFSWITCH instead of your CFIF statements:

<cfswitch expression="#center#">
    <cfcase value="DAL"><cfset to = tod></cfcase>
    <cfcase value="HOU"><cfset to = toh></cfif>
    <cfcase value="KC"><cfset to = tok></cfif>
    <cfcase value="TUL"><cfset to = tot></cfif>
</cfswitch>

Third, You don't need to put pound signs around everything. Only when ouputting a value or sending a value to a CF tag or Custom tag.

Fourth, If you are referring to form variables, use the form scope:

form.manager

Even though using just 'manager' will work, not scoping will produce issues in situations where you might have 2 variables with the same name in different scopes (it's very possible).

Finally, turn on debugging and watch the process at the bottom of the screen. Check to see exactly what form variables are being passed through to each page. If you can't do that (or don't want to) you can alternativly try looping through the Form.FieldNames variable and outputting it's value on each page, something like so:

<cfoutput>#form.fieldNames#<br /></cfoutput>

<cfloop list="#form.fieldNames#" index="fieldName">
  <cfoutput>#fieldName# = #Evaluate("form.#fieldName#")#<br /></cfoutput>
</cfloop>
0
 
LVL 2

Accepted Solution

by:
dlewis9 earned 600 total points
ID: 8221145
I'm gonna chalk it up to a Microsoft Bug, or something quirky in the security settings of Outlook.  I couldn't find a solution, but did find someone describing the same issue:

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=udkiod8oem3m6a%40corp.supernews.com

Unfortunately, the person helping out on that thread had no idea either.

My suggestion would be to use METHOD=GET for your form posting from inside the email and if you use variable scope (as suggested above) be sure to change from FORM.variable to URL.variable

Seemed to work out ok in my testing..!  The user clicks submit from the email, and a browser pops up with all their form variables on the URL line, and the email gets sent back to the original requestor sucessfully.

(I used a copy of your code in testing, and after modifying a few spots that were left out mistakenly when you pasted to your message, I was able to get it to work)

(Code that was changed is below)

<form action="http://mydomain.com/response_toreq.cfm" method="GET" name="send">

0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 17

Expert Comment

by:anandkp
ID: 8222740
i guess if thigns r working fine for some & NOT for others - then there's ONE possiblity

the other people [for whom it dosent work] may be having text based EMAil client.

u'll need to identify the preferences of people recieving ur mails & ONLY if ur sure they recieve a email in HTML format, u can use <cfmail type="HTML" ... - Else u need to go for plaintext format & make sure u set thigns right by using appropriate HREFs/LINKS on the emails -

i am not sure - but i guess thats what happening above - is it ???

K'Rgds
Anand
0
 

Author Comment

by:mbogert
ID: 8227850
dlewis9 and TallerMike:

Thanks very much for your input!  I changed the method to "GET" and this seemed to do the trick for Outlook.  I figured it had something to do with browser settings or a bug, but wanted to be sure.  Also, thanks Mike for the input on making my code more concise and reliable...I'll get the hang of this stuff one of these days.

I'm new to this forum so I'm not sure how the point assigning works.  I had to take dlewis9's answer, because he/she solved my specific problem, but I'd like to send some of the points your way, Mike, for helping me out with the code.  If I figure out how to do it, I'll give you some.  Thanks again for bailing me out of this headache!
0
 
LVL 8

Expert Comment

by:TallerMike
ID: 8228365
mbogert, no problem. To give points to experts, you'll need to setup a question like so:

'Points for #expertName#'

Where expertName is the experts name. Make it worth whatever points you want to give them. The expert should leave a comment thanking you for the points, and you simply choose that response as the answer. It's a little backwards, but it's how it's done!

I suggest that you check out a post that the experts here have all contributed to regarding Cold Fusion Optimization:

http://www.experts-exchange.com/Web/WebDevSoftware/ColdFusion/Q_20542979.html
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month8 days, 12 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question