Question

'From' and 'Subject' fields in sendmail script

Asked by: browerjason

SYMPTOMS:

I am using a simple form processing script that I modified out of a book.  Currently when the form is processed the results are emailed to me, but the mail is from 'nobody' and the 'subject' field is empty.

DESIRED RESULTS:

I would like to edit the script so when I get the email, the mail has a subject that I specify and it is from a specific person.

QUESTION:

Since I do not 'know' Perl, I want to know just exactly what I need to add to my code so that I achieve the desired results.(Note that I replaced my email with X's in the script.)

CURRENT SCRIPT:

#!/usr/local/bin/perl

use CGI::Carp qw(fatalsToBrowser);

require ('cgi-lib.pl');
&ReadParse;

print "Content-type:text/html\n\n";
open (MAIL,"|/usr/lib/sendmail XXX\@XXX.com");
print MAIL<<"_MAILEND_";
Customer Feedback Information\n\n
How this person heard about us:\n
$in{'siteMedia'}\n\n
They are interested in these manufacturers:\n
$in{'manufacturers'}\n\n
They are this amount satisfied with Orderdoors.com:\n
$in{'satisfaction'}\n\n
The comments that they submitted are:
$in{'written_comments'}\n\n
Their e-mail address is:\n
$in{'e-mail'}\n\n
_MAILEND_
;
close(MAIL);
print<<"_ENDMSG_";

<!--begin HTML-->

<html>
<head>
   <title>Form Results</title>
</head>
<body>

<center>
<H1>Thank you! Your Feedback has been submitted.</H1>
</center>

</body>
</html>
_ENDMSG_
;

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2000-12-10 at 11:26:59ID20003051
Tags

how

Topic

Perl Programming Language

Participating Experts
1
Points
200
Comments
23

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Sendmail
    How do I send mail from my application to a group of people. I guess that I could use sendmail. How do I program sendmail to achieve this task ? I don't have much idea about sendmail
  2. Sendmail
    I am using Sendmail to send mails from my Perl/CGI scripts. Currently, the mails are simple and plain text mails. I want to use an html page as the background for all these mails to send out branded mails, just like how we do in outlook or outlook express. How is that possible?
  3. problem with '/usr/lib/sendmail'
    #!/usr/local/bin/perl ## ## printenv -- demo CGI program which just prints its environment ## #print "Content-type: text/html\n\n"; use CGI; use strict; use CGI::Carp qw(fatalsToBrowser); #### define all variables that we will use my $SENDMAIL = '...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: browerjasonPosted on 2000-12-10 at 11:50:32ID: 7742

I have increased the points because I have an additional question.  Is there a way to set up the script so that it will only email me the results of those fields that are not empty?

I want to be able to have an order form for sales reps supplys (not by credit card).  I am using an email script similar to the one above, however I recieve a result for every field, wether or not the user ordered that particular item.

thanks  

 

by: maneshrPosted on 2000-12-10 at 12:24:52ID: 7795

browerjason,

". Is there a way to set up the script  so that it will only email me the results of those fields that are not empty?.."

After seeing the above code, i can see that validations can be added in the code so that all the mandatory fields are not empty. The PERL script can enforce these validations.

Also since you have the CGI module, i think you can stop using the cgi-lib.pl file.

Also i think there would be a HTML file that calls this PERL script. it would be in this HTML file that the users enters the info.

Can you pl. post that HTML file here??

I can write a small PERL script, using the CGI module, to do all that you want.

Let me know.

 

by: maneshrPosted on 2000-12-10 at 13:01:08ID: 7839

browerjason,

"...DESIRED RESULTS:

                     I would like to edit the script so when I get the email, the mail has a subject that I specify and it
                     is from a specific person...."

based on the input you provided above, i have created my own version of the HTML form that would call this script. Chances are you might be using a drop-down list box, but since i am not sure of that i have used a simple text box all along.

The same code would however work with a drop-down list box too.

this PERL code has a lot of flexibility built into it.

For eg. all the hard-coded values are stored in one location. so your name, email id and subject can be easily changed without touching the core logic of the program.

Also now you can see the email id of the sender in the from part of the email. to show the users actual name i would have to add another item to the HTML file and the PERL script.
 
NOTE: i have made on the email id mandatory right now.
If required this mandatory check can be extended to other fields too.

Also i have commented the PERL code so that you will find it easier to understand and maintain the same.

Let me know as much more details as you can.


========feedback.html
<TITLE>Customer Feedback Form</TITLE>
<form method=post action="/cgi-bin/feedback.pl">
<B>How did you hear about us</B>
<input type=text name=siteMedia><P>
<B>I am interested in these manufacturers</B>
<input type=text name=manufacturers><P>
<B>Amount satisfied with Orderdoors.com</B>
<input type=text name=satisfaction><P>
<B>Comments</B><BR>
<Textarea rows=10 cols=60 name=written_comments></textarea><P>
<B>Your e-mail address</a>
<input type=text name=e-mail><P>
<input type=submit>
</FORM>

========feedback.pl
#!/usr/local/bin/perl

$|++; ##  Disable output buffering
use CGI;

$query=new CGI; ##  Create a new CGI object

##  Your (recipients) name and email id.
my($to) = 'jason_brower@server.com';
my($to_name) = 'Jason Brower';

##  The Subject of the email
$subject ="Customer Feedback Information\n";

##  Full path to the sendmail MTA
$mailprog ="/usr/lib/sendmail";

##  Print the MIME header
print "Content-type: text/html\n\n";

##  Read the HTML file variables into PERL.
my($from) = $query->param('e-mail');
my($siteMedia)= $query->param('siteMedia');
my($manufacturers)= $query->param('manufacturers');
my($satisfaction)= $query->param('satisfaction');

##  The users written comments to be sent with the email
$comments= $query->param('written_comments');

die('<B>Sender Email id not found</B>') if (! $from);
die('<B>Receipient Email id not found</B>') if (! $to);

open(MAIL, "| $mailprog -t ") || die $!;

##  Put the sender, receipient and subject of the email.
print MAIL "To: <$to> $to_name\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n";

##  This is the actual body of the email.
print MAIL qq{
How this person heard about us:
$siteMedia

They are interested in these manufacturers:
$manufacturers

They are this amount satisfied with Orderdoors.com:
$satisfaction

The comments that they submitted are:
$written_comments

Their e-mail address is:
$from
};
print MAIL "\n";

##  Send out the email
close(MAIL);

##  Now print the HTML page thanking the user.
print qq{
<!--begin HTML-->

<html>
<head>
<title>Form Results</title>
</head>
<body>

<center>
<H1>Thank you! Your Feedback has been submitted.</H1>
</center>

</body>
</html>
};

 

by: browerjasonPosted on 2000-12-10 at 14:37:15ID: 7976

I tried to use the above script with the feedback form, however if the fields were left blank it forwards the page to a blank white screen instead of a warning message.  Also, when I put data in the fields, I make it to the thank you screen after I submit, but never recieve the email.  This is not working yet.

---------------------------------------------------------
About the other situation, below is the actual HTML file that I am using for the sales order form.

<HTML>
<HEAD>

<meta http-equiv="Pragma" content="no-cache">
<TITLE>Sales Reps Order Form</TITLE>

</HEAD>

<BODY background="drywall.jpg">

<center>
<H1>Sales Reps Order Form</H1>
</center>

<HR>

<FORM ACTION="cgi-bin/repforms.pl" method="POST">

<center>
<table  border="1" cellspacing="1" cellpadding="1" bgcolor="#ffffff">
     <tr>
        <td align="center" bgcolor="#ffcc00" colspan="4"><b>Personal Information</b>
        </td>
     <tr>
        <td bgcolor="#efefef">
           <font color="#000000"><b>First Name</b></font>
        </td>
       
        <td align="right">
           <input name="firstname" type="text">
        </td>

        <td bgcolor="#efefef">
           <font color="#000000"><b>Last Name</b></font>
        </td>
       
        <td align="right">
           <input name="lastname" type="text">
        </td>
     </tr>

     <tr>
        <td bgcolor="#efefef">
           <font color="#000000"><b>Address</b></font>
        </td>
       
        <td align="right">
           <input name="address" type="text">
        </td>

        <td bgcolor="#efefef">
           <font color="#000000"><b>City</b></font>
        </td>
       
        <td align="right">
           <input name="city" type="text">
        </td>
     </tr>

     <tr>
        <td bgcolor="#efefef">
           <font color="#000000"><b>State</b></font>
        </td>
       
        <td align="right">
           <input name="state" type="text">
        </td>

        <td bgcolor="#efefef">
           <font color="#000000"><b>Zip</b></font>
        </td>
       
        <td align="right">
           <input name="zip" type="text">
        </td>
     </tr>
     <tr>
        <td bgcolor="#efefef">
           <font color="#000000"><b>Daytime Phone</b></font>
        </td>
       
        <td align="right">
           <input name="day_phone" type="text">
        </td>

        <td bgcolor="#efefef">
           <font color="#000000"><b>E-mail</b></font>
        </td>
       
        <td align="right">
           <input name="email" type="text">
        </td>
     </tr>

     <tr>
        <td bgcolor="#efefef">
           <font color="#000000"><b>Fax Number</b></font>
        </td>
       
        <td align="right">
           <input name="fax" type="text">
        </td>
        <td colspan="2" bgcolor="#efefef">&nbsp;
        </td>
     </tr>

</table>
</center>

<br><br>
<HR>
<br><br>
<center>
    <table width="89%" border="1" cellspacing="1" cellpadding="1" bgcolor="#ffffff">
      <tr>
        <td bgcolor="#ffcc00"><b>Item #</b></td>
        <td bgcolor="#ffcc00"><b>Brochure Name</b></td>
        <td bgcolor="#ffcc00"><b>Qty. Ordered</b></td>
      </tr>
      <tr>
        <td bgcolor = "#EFEFEF">2221100</td>
        <td>Full Line Color Brochure (25 per)</td>
        <td><input name="2221100" type="text"></td>
      </tr>
      <tr>
        <td bgcolor = "#EFEFEF">2231100</td>
        <td>Designer Collection Brochure (50 per)</td>
        <td><input name="2231100" type="text"></td>
      </tr>
      <tr>
        <td bgcolor = "#EFEFEF">2241100</td>
        <td>Color Collection Brochure (50 per)</td>
        <td><input name="2241100" type="text"></td>
      </tr>
      <tr>
        <td bgcolor = "#EFEFEF">2251100</td>
        <td>PVC Collection Brochure (50 per)</td>
        <td><input name="2251100" type="text"></td>
      </tr>
      <tr>
        <td bgcolor = "#EFEFEF">2261100</td>
        <td>Builders Edge Brochure (50 per)</td>
        <td><input name="2261100" type="text"></td>
      </tr>
      <tr>
        <td bgcolor = "#EFEFEF">2271100</td>
        <td>World Wide Brochure (50 per)</td>
        <td><input name="2271100" type="text"></td>
      </tr>
      <tr>
        <td bgcolor = "#EFEFEF">2281100</td>
        <td>Designer Glass Collection Brochure (50 per)</td>
        <td><input name="2281100" type="text"></td>
      </tr>
      <tr>
        <td bgcolor = "#EFEFEF">2291100</td>
        <td>Warranty (10 per)</td>
        <td><input name="2291100" type="text"></td>
      </tr>
      <tr>
        <td bgcolor = "#EFEFEF">2301100</td>
        <td>Defective Claim Forms (25 per)</td>
        <td><input name="2301100" type="text"></td>
      </tr>
      <tr>
        <td bgcolor = "#EFEFEF">2311100</td>
        <td>Sales Order Forms (50 per)</td>
        <td><input name="2311100" type="text"></td>
      </tr>
      <tr>
        <td bgcolor = "#EFEFEF">2321100</td>
        <td>Dealer Sample Door Order Forms (25 per)</td>
        <td><input name="2321100" type="text"></td>
      </tr>
      <tr>
        <td bgcolor = "#EFEFEF">2331100</td>
        <td>Credit Applications (10 per)</td>
        <td><input name="2331100" type="text"></td>
      </tr>
      <tr>
        <td bgcolor = "#EFEFEF">2341100</td>
        <td>Container Calculation Form (10 per)</td>
        <td><input name="2341100" type="text"></td>
      </tr>
      <tr>
        <td bgcolor="#ffcc00"><b>Item #</b></td>
        <td bgcolor="#ffcc00"><b>Video</b></td>
        <td bgcolor="#ffcc00"><b>Qty. Ordered</b></td>
      </tr>
      <tr>
        <td bgcolor = "#EFEFEF">2611100</td>
        <td>Video of Plant in China</td>
        <td><input name="2611100" type="text"></td>
      </tr>
      <tr>
        <td bgcolor = "#EFEFEF">2621100</td>
        <td>Video of Product Line and Displays</td>
        <td><input name="2621100" type="text"></td>
      </tr>
      <tr>
        <td bgcolor="#ffcc00"><b>Item #</b></td>
        <td bgcolor="#ffcc00"><b>Displays</b></td>
        <td bgcolor="#ffcc00"><b>Qty. Ordered</b></td>
      </tr>
      <tr>
        <td bgcolor="#EFEFEF">3811100</td>
        <td>Small Door Display with Handles</td>
        <td><input name="3811100" type="text"></td>
      </tr>
      <tr>
        <td bgcolor="#EFEFEF" valign="top">3821110</td>
        <td>Designer Sample Kit of wood grains, color chips, 8-point lock system,
          polyurethane core sample, and center steel rod samples.(1 Per)</td>
        <td><input name="3821100" type="text"></td>
      </tr>
      <tr>
        <td bgcolor="#EFEFEF">3351100</td>
        <td>Designer Samples, includes wood grain (1 per)</td>
        <td><input name="3351100" type="text"></td>
      </tr>
      <tr>
        <td bgcolor="#EFEFEF">3361100</td>
        <td>Color Chips for Color Collection (1 per)</td>
        <td><input name="3361100" type="text"></td>
      </tr>
    </table>
    <br><br>

<input type="submit" value="Press to Submit">

  </form>
<HR>

</center>


</BODY>
</HTML>

 

by: maneshrPosted on 2000-12-10 at 15:49:18ID: 8091

browerjason,

"..however if the fields were left blank it forwards  the page to a blank white screen instead of a warning message.."

Please refer to my earlier comments of the mandatory fields for this.


"..Also, when I put data in the fields,  I make it to the thank you screen after I submit, but never recieve the email. ..."

did you change the script i posted above to add your email id in it??

can you post the exact script that you are using here?

Can you post the URL where i can see this HTML page and the script in action??

Are you sure the HTML file posted above is the one that calls the PERL script you originally posted??

the HTML form you have posted is completely different from the one that is required by your original script.
i am looking for a feedback form of some kind that the user submits.

is there such a HTML file at all? is this HTML file generated by a script?

pl. post as much detail as you can.

That would help you get a more accurate answer.

 

by: browerjasonPosted on 2000-12-10 at 16:20:22ID: 8119

"..however if the fields were left blank it forwards  the page to a blank white screen instead of a
warning message.."

Please refer to my earlier comments of the mandatory fields for this.

My problem with this is that a blank white page does not tell the person anything.  It should at least say that the field was left blank and needs to be filled out.


And yes I did forget to change the email in the script.  My appologies.  However, I still need to warn the visitor that they need to fill in the blanks.


 

by: maneshrPosted on 2000-12-10 at 17:03:11ID: 8145

browerjason,

".. It should at least  say that the field was left blank and needs to be filled out...."

if you refer to my earlier comment...
"NOTE: i have made on the email id mandatory right now.
                     If required this mandatory check can be extended to other fields too..."

The first thing that i am aiming for is getting a working script for you.
the *next* thing would be to identify all the mandatory fields and put the appropriate text messages for the same.

i would suggest you completely read the comments before posting additional comments here.

Also let us focus of first things first, i.e getting the script to work and send you an email.

let me know your thoughts on the same.

 

by: browerjasonPosted on 2000-12-10 at 17:17:28ID: 8166

Indeed I can assure you that I have read all of your comments.  And yes I do have a working script that emails me, as I had mentioned in the previous email where I appologized for not changing the email address in the script.

Now we need to take care of the fact that if information is missing, we need to display the appropriate message, rather than a blank white screen.  This way the customer know to go back and put the information in the field.



 

by: maneshrPosted on 2000-12-10 at 18:17:04ID: 8244

browerjason,

".nd yes I do have a working script that  emails me, ."

Excellent! so we have hit the first part of our target. not lets go on to the next one.

"..Now we need to take care of the fact that if information is missing, we need to display the appropriate
message, rather than a blank white screen. .."

let us take the HTML file that i had posted earlier.

in that file, can you pl tell me which fields must always be entered??

once i have the fields with me, i will modify the script so that only valid (non-empty) data will be accepted.

let me know.

 

by: browerjasonPosted on 2000-12-10 at 20:16:31ID: 8406

The only field that is necessary with the feedback form would be the email address.  However, in another form I will have several fields that are necessary.  I will learn how you do this email field and then figure the rest out on my own using this example.


Thanks

 

by: maneshrPosted on 2000-12-11 at 10:53:25ID: 9186

browerjason,

"..The only field that is necessary with the feedback form would be the email address. .."

The code that i have posted above already takes care of this.


##  Read the HTML file variables into PERL.
my($from) = $query->param('e-mail');
......

die('<B>Sender Email id not found</B>') if (! $from);

To futher strengthen this check ADD these lines...

$from=~ s/^\s+//; ## Remove leading white spaces
$from=~ s/\s+$//; ## Remove trailing white spaces

BEFORE....
die('<B>Sender Email id not found</B>') if (! $from);

Let me know how it goes.

 

by: browerjasonPosted on 2000-12-11 at 14:09:36ID: 9417

I added the code that you posted in the appropriate place and I am still forwarded to a blank white screen when the email field is left blank?

Got any other clues?

 

by: maneshrPosted on 2000-12-11 at 15:38:10ID: 9625

browerjason,

"..screen when the email field is left blank?

                     Got any other clues? .."

Can you post the URL where i can look at the HTML form??

can you post the exact PERL code that you are using here???

 

by: browerjasonPosted on 2000-12-11 at 16:28:00ID: 9722

I would prefer to not let the URL be known,  Below is the perl script and after that is the html form.  Just paste the html into notepad and open it in your browser.



#!/usr/local/bin/perl

$|++; ##  Disable output buffering
use CGI;

$query=new CGI; ##  Create a new CGI object

##  Your (recipients) name and email id.
my($to) = xxx@xxx.com';
my($to_name) = 'j b';

##  The Subject of the email
$subject ="Customer Feedback Information\n";

##  Full path to the sendmail MTA
$mailprog ="/usr/lib/sendmail";

##  Print the MIME header
print "Content-type: text/html\n\n";

##  Read the HTML file variables into PERL.
my($from) = $query->param('e-mail');
my($siteMedia)= $query->param('siteMedia');
my($manufacturers)= $query->param('manufacturers');
my($satisfaction)= $query->param('satisfaction');

##  The users written comments to be sent with the email
$comments= $query->param('written_comments');

$from=~ s/^\s+//; ## Remove leading white spaces
$from=~ s/\s+$//; ## Remove trailing white spaces
die('<B>Sender Email id not found</B>') if (! $from);
die('<B>Receipient Email id not found</B>') if (! $to);

open(MAIL, "| $mailprog -t ") || die $!;

##  Put the sender, receipient and subject of the email.
print MAIL "To: <$to> $to_name\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n";

##  This is the actual body of the email.
print MAIL qq{
How this person heard about us:
$siteMedia

They are most interested in this style of door:
$manufacturers

They are this amount satisfied with Messon:
$satisfaction

The comments that they submitted are:
$written_comments

Their e-mail address is:
$from
};
print MAIL "\n";

##  Send out the email
close(MAIL);

##  Now print the HTML page thanking the user.
print qq{
<!--begin HTML-->

<html>
<head>
<title>Form Results</title>
</head>
<body bgcolor="#ffffcc">

<center>
<H1>Thank you! Your Feedback has been submitted.</H1><br><br>
<a href="http://www.xxx.com/index.htm">Back Home</a>
</center>

</body>
</html>
};

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

<HTML>
<HEAD>

<meta http-equiv="Pragma" content="no-cache">
<TITLE>Feed Back</TITLE>

</HEAD>

<BODY background="drywall.jpg">
<center>

<H2>Please give us your suggestions and comments.</H2>
</center>


<p><image src="feather.gif"><b>We are interested in your comments and suggestions.  If you feel that there is anything that we can do to improve our service, please let us know about it.  Complete the short form below and send it in to be processed.  Thank you for visiting our site and have a wonderful day!</b>

<HR>

<FORM ACTION="cgi-bin/feedback.pl" method="POST">


 <P><font color="0000ff"><b>How did you find out about this site?</b></font>
<SELECT NAME="siteMedia">
  <OPTION>Search Engine</option>
  <option>Family or Friend</option>
  <option>Newspaper</option>
  <option>Television</option>
  <option>Magazine</option>
  <option>Other</option>
</select>
 </p>

<br><br>
 <p><font color="0000ff"><b>What style of doors are you most interested in?</b></font>
<input name="manufacturers" type="text">
 </p>

<br><br>
 

 <p><font color="0000ff"><b>How satisfied are you with our service?</b></font> <font color="000000">
<SELECT NAME="satisfaction">
  <OPTION>Completley Satisfied</option>
  <option>Mostly Satisfied</option>
  <option>Somewhat Satisfied</option>
  <option>Not Satisfied</option>
  <option>Dissapointed</option>
  <option>Other</option>
</select></font>
 
 </p>

<br><br>
  <p><font color="0000ff"><b>Enter comments here:</b></font>
   <center><textarea name="written_comments" rows="10" cols="30"></textarea>
 </p>
 </center>

<br><br>

 <p><font color="0000ff"><b>What is your e-mail address?<b></font>
 <input type="text" name="e-mail">
 </p>

<br><br>

 <p>

 <center>
 <input type="submit" value="Press to Submit">
 </center>

 </p>

</form>
<HR>

<center>
<font color="#000000">
<p>Copyright ) 2000 xyxy inc.</p>
</font>
</center>


</BODY>
</HTML>

 

by: maneshrPosted on 2000-12-11 at 16:33:47ID: 9738

browerjason,

"I would prefer to not let the URL be known,  ..."

Hmm..

"..Below is the perl script and after that is the html form. "

i would suggest you REPLACE ....

die('<B>Sender Email id not found</B>') if (! $from);

WITH...

if (! $from){
  print "<B>Sender Email id not found</B>\n";
  exit;
}

Let me know what happens when you have made the change.

 

by: browerjasonPosted on 2000-12-11 at 17:41:28ID: 9848

Good, now your code is working correctly.  To finish one of the original questions, how do we set up the code so that it only emails the fields that are not blank.  I need to use this with the sales reps order form that I was talking about several comments ago.  The rep has the opportunity to order from about fifty different items within the page.  I do not want to recieve an email that has 48 items with nothing and only two items ordered?  How do I solve this, so that it show only the items that are ordered. (Keep in mind that this is not an e-commerce site, the reps materials are free). I added fifty points.

Thanks

 

by: maneshrPosted on 2000-12-11 at 19:35:28ID: 10085

browerjason,

".. To finish one of the original questions, how do we set up  the code so that it only emails the fields that are not blank..."


REPLACE...

##  This is the actual body of the email.
print MAIL qq{
How this person heard about us:
$siteMedia

They are most interested in this style of door:
$manufacturers

They are this amount satisfied with Messon:
$satisfaction

The comments that they submitted are:
$written_comments

Their e-mail address is:
$from
};


WITH....

##  This is the actual body of the email.
print MAIL qq{
How this person heard about us:
$siteMedia} if !$site

print MAIL qq{
They are most interested in this style of door:
$manufacturers} if !$manufacturers;

print MAIL qq{
They are this amount satisfied with Messon:
$satisfaction} if $satisfaction;

print MAIL qq{
The comments that they submitted are:
$written_comments} if $written_comments;


print MAIL qq{
Their e-mail address is:
$from
} if !$from
                     

 

by: browerjasonPosted on 2000-12-12 at 19:48:51ID: 13391

Actually the above code should be replaced with what I have below.  Notice in your code above you have negated the first two variables like this -> if !$site, and the second two without the negation like this -> if satisfaction.  Also in order for the code to work, the if keyword should be placed before the action and the action should be enclosed in braces.  (See the code below)

However, thanks for leading me in the right direction!

##  This is the actual body of the email.
if ($site){
print MAIL qq{
How this person heard about us:
$siteMedia}
}

if ($manufacturers){
print MAIL qq{
They are most interested in this style of door:
$manufacturers}
}

if ($satisfaction){
print MAIL qq{
They are this amount satisfied with xxx:
$satisfaction}
}

if ($written_comments){
print MAIL qq{
The comments that they submitted are:
$written_comments}
}


if ($from){
print MAIL qq{
Their e-mail address is:
$from}
}
print MAIL "\n";

##  Send out the email
close(MAIL);

 

by: browerjasonPosted on 2000-12-12 at 19:50:07ID: 13393

Thanks for the help, good job.

 

by: maneshrPosted on 2000-12-12 at 22:24:33ID: 13687

browerjason,

"..Thanks for the help, good job. ."

... yet you feel that it did not deserve an "Excellent" grade??

what sort of answer were you looking for?

pl. let me know.

 

by: browerjasonPosted on 2000-12-12 at 23:06:37ID: 13787

Now don't get bent out of shape.  I think that "good" is when an "expert" goes the extra mile to answer a question and leads the person in the correct direction.

Excellent is when an "expert" sees what question is beeing asked and gives the solution to the problem without changing the code several times.  Hence, your solution worked after I changed the code to remove the logical and syntactical errors.

Don't sweat it, you got an A but not an A+.  

 

by: maneshrPosted on 2000-12-13 at 19:05:13ID: 17134

browerjason,

"..Excellent is when an "expert" sees what question is beeing asked and gives the solution to the problem
without changing the code several times.  Hence, your solution worked after I changed the code to remove
the logical and syntactical errors..."


imagine working virtually over the net, without me having access to your server, having to understand the entire code logic  on my own, then trying to think that the original coder was thinking when the code was created and then figuring out the solution.

You are something, my friend.

Anyway, its good to know your thoughts on the same.

here is a URL you might want to refer to...

http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp#3

 

by: browerjasonPosted on 2000-12-13 at 19:46:27ID: 17215

no, YOU are something, getting all worked up over a 'B'.  Did you give other people this much 'static' about getting those other 'B's you had gotten?  Why did they give you the same grade that I did?????

HOWEVER, I did visit the URL that you posted and found that according to the rules, you did get an 'A'.  I did not realize that this would be taken so seriously.  If I had done it all over again I would have given you an 'A' for your help, not because you complained so much!

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...