Advertisement

03.25.2008 at 09:46AM PDT, ID: 23267646
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

form script runs slow and sometimes fails
I have several scripts that are very similar that process forms. They run very slowly now and sometimes fail. When the pop up that tells the user the form went thru shows "Content-type: text/html" on the top, it doesn't send the email.

System info - Windows Server 2003, IIS 6, perl, sendmail, Exchange 2003 on same box which is domain controller

This used to work fine for a long time. Why would it change?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
#!perl/bin
 
use CGI::Carp qw(fatalsToBrowser);
# simple CGI script email form data
 
use CGI;
use CGI qw(param);
my $query = new CGI;
 
@months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
@weekDays = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
$year = 1900 + $yearOffset;
$theTime = "$hour:$minute:$second, $weekDays[$dayOfWeek] $months[$month] $dayOfMonth, $year";
 
@names = $query->param;
open F, ">data/leave/leavereq $hour$minute $second $months[$month]-$dayOfMonth-$year.txt";
print F "\n", $_, $query->param ($_) foreach $query->param;
close F;
 
## Create a new CGI object
$query=new CGI;
 
@super_ids=(
'someone@domain.com',
'another@domain.com'
);
 
foreach ($query->param){
$$_=$query->param($_);
}
 
# path to sendmail program, if it's in the cgi-bin directory then no path is needed
# if you use a full path, then use back slashes and single quotes, e.g 'c:\path\to\sendmail'
my $mailprog = 'c:\usr\lib\sendmail';
$| = 1;
open(MAIL, "| $mailprog -t ");
print MAIL "To: $from,$super_ids[$to]\n";
print MAIL "From: $from\n";
print MAIL "Subject: Requestfor leave\n";
print MAIL "Content-type: text/html\n";
print MAIL "\n";
 
print MAIL "
<html>
$forminfo
</HTML>\n";
 
close(MAIL);
 
## Print the MIME type
print "Content-type: text/html\n\n";
 
print "<BODY BGCOLOR=#f5f5f5><div align=center><table border=0 width=200 height=100% cellspacing=0 cellpadding=0><td width=100% valign=middle align=center><h3>Your Request for Leave has been sent to $super_ids[$to] and $from</h3></td></table></div>\n";
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: stone5150
Solution Provided By: Adam314
Participating Experts: 3
Solution Grade: A
Views: 8
Translate:
Loading Advertisement...
03.25.2008 at 10:29AM PDT, ID: 21204051

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.25.2008 at 10:51AM PDT, ID: 21204278

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.25.2008 at 10:57AM PDT, ID: 21204326

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.25.2008 at 11:21AM PDT, ID: 21204552

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.25.2008 at 11:24AM PDT, ID: 21204567

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.25.2008 at 11:35AM PDT, ID: 21204672

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.25.2008 at 01:27PM PDT, ID: 21205785

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.25.2008 at 09:31PM PDT, ID: 21208895

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.25.2008 at 10:45PM PDT, ID: 21209121

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.25.2008 at 10:50PM PDT, ID: 21209136

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.26.2008 at 06:37AM PDT, ID: 21211412

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
03.25.2008 at 10:29AM PDT, ID: 21204051

Rank: Genius

Not sure if this is causing the problem, but you are creating 2 CGI objects.  First on line 8 named $query, then again on line 22, also named $query.  You only need one, it can be used throughout the program.

I'm not sure what lines 29-31 are doing.

The $forminfo used on line 46 is never set anywhere.
 
03.25.2008 at 10:51AM PDT, ID: 21204278
I have long since forgotten why I created the $query things and which go to what.

29 -31 pick the name from the list of email addresses, which in reality is much longer.

$forminfo is data from the form which comes from HTML form, just a placeholder here but real script has several different one that vary from form to form.
 
03.25.2008 at 10:57AM PDT, ID: 21204326

Rank: Genius

I would guess the problem is the creating of two CGI objects.  If the form is POSTed, the CGI module will read the data from STDIN.  The first CGI object will do this and have no problem.  The second CGI object won't be able to read, because the data will have already been read.  

Try removing or commenting out line 22, the creation of a new CGI object.
 
03.25.2008 at 11:21AM PDT, ID: 21204552
That got rid of the random "Content-type: text/html" thing that sometimes appeared on the pop up confirmation window but it still takes quite a while to load that.
 
03.25.2008 at 11:24AM PDT, ID: 21204567
Actually that still comes up once in a while.
 
03.25.2008 at 11:35AM PDT, ID: 21204672

Rank: Genius

Try removing or commenting out line 7, that has use CGI qw(param) on it.  This is just loading the module a second time, which isn't necessary.

When I test it, it seems to run just fine.  Is there anything in your error log?
 
03.25.2008 at 01:27PM PDT, ID: 21205785

Rank: Wizard

The occasional extra printing of "Content-type: text/html" and the slow running is most likely coming from the portion of the script that you didn't show us.

There are several important items missing from your posted code, and presumably missing from your actual script.

1) You need to use the strict and warnings pragmas in EVERY script you write.
2) You should ALWAYS check the return code of an open call to verify that it was successful and take action if it wasn't.
3) You can/should clean up portions of the script, such as your assigning of the $theTime var.
4) Since Perl 5.6, it's preferred/better to use a lexical var for the filehandle

1:
2:
3:
4:
5:
6:
7:
8:
use strict;
use warnings;
use POSIX 'strftime';
 
my $theTime = strftime("%H:%M:%S, %a %b %d, %Y", localtime);
my $file = strftime("data/leave/leavereq %H%M %S %b-%d-%Y.txt", localtime);
 
open my $FILE, '>', $file or die "Can't open '$file' $!";
Open in New Window
 
03.25.2008 at 09:31PM PDT, ID: 21208895
Cleared up those problems now I am getting this-

sendmail: Error during delivery: From: address not verified; see http://help.yahoo.com/l/us/yahoo/mail/original/manage/sendfrom-07.html

What does that mean? I went to the link and it refers to Yahoo! mail but nothing about sendmail
 
03.25.2008 at 10:45PM PDT, ID: 21209121

Rank: Sage

What From address did you use?
 
03.25.2008 at 10:50PM PDT, ID: 21209136
My work and sbcglobal addy got that, but gmail addy didn't (?)
 
03.26.2008 at 06:37AM PDT, ID: 21211412

Rank: Genius

It looks like your sendmail is configured to use yahoo as your mail server.  So when you use sendmail, it actually sends through yahoos mail servers.  In order to do that, your from address needs to be entered in your yahoo account - this is to prevent spam (yahoo will not send your mail unless your from address is a real e-mail).

So you need to log in to your yahoo account using the instructions on the link, and enter the e-mail address you want to use as the from address.  That will be the only address that will work then.  

If your gmail address is working, then you may have already set up your yahoo to work with gmail - or yahoo may have another way to verify your gmail address.
Accepted Solution
 
 
20080236-EE-VQP-29 / EE_QW_EXPERT_20070906