?
Solved

Problem with cfmail response from end-user

Posted on 2003-03-27
6
Medium Priority
?
265 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
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
Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

 
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

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

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

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Screencast - Getting to Know the Pipeline
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month12 days, 23 hours left to enroll

578 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