Results 1 to 10 of 10

Thread: PERL sendmail /form with confirmation form

  1. #1
    Registered
    Join Date
    Jul 2009
    Location
    US
    Posts
    3
    Rep Power
    0

    PERL sendmail /form with confirmation form

    Hello All,

    I'm new for this forum.

    I'm learning about web programming and I'm stuck at my form page. I'm using PERL form for my contact us form and when I click on submit button, I'm not getting my confirmation form which is included with my header, navigation and footer.
    Here is my sendmail.pl code.
    Code:
    #!/usr/bin/perl
    use CGI::Carp qw(fatalsToBrowser);
    print "Content-type: text/html\n\n";
    $title= 'Acme Mail Confirmation';
    $to= 'webdevteacher@gmail.com';
    $from= 'cooks@yahoo.com';
    $subject= 'Acme Mail Confirmation';
    open(MESSAGE, "|/usr/sbin/sendmail");
    ## MESSAGE Header
    print MESSAGE "To: $to\n";
    print MESSAGE "From: $from\n";
    print MESSAGE "Subject: $subject\n\n";
    close(MESSAGE);
    ## HTML content lets user know we sent an email
    print "<html><head><title>$title</title><head>\n<body>\n\n";
    
    print "<h1>$title</h1>\n";
    print "<p>Hello Friend,\n";
    print "<p>Thank you for visiting Acme Indian Arts Store.  Also thank you for your feedback.  If you have provided your email address, we will contact shortly.\n";
    print "<p>Thank you for your patronage.\n";
    print "<p>A message has been sent from $from to $to";
    print "\n\n</body></html>";
    
    
    And here is my confirmation.shtml code:
    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
        "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
     <!-- BOF: Generated Meta Tags -->
        <meta name="description" content="Acme Widget - the Indian Art Store of your choice." />
        <meta name="keywords" content="Arts and Crafts, Statues, Jewelry, Paintings, Spiritual Accessories." />
        <meta name="author" content="P-----y, Web Developer" />
        <meta name="copyright" content="2009, P-------y" />
        <meta name="reply-to" content="info[at]acmewidget.com" />
        <title>Acme Widget - Arts and Crafts of India</title>
    <!-- EOF: Generated Meta Tags -->
      
    <link rel="stylesheet" href="css.sheet1.css" type="text/css" />
    <script type="text/javascript">
    <!-- Hide from old browsers
         function createWindow(cUrl,cName,cFeatures)
        {
        var xWin = window.open(cUrl,cName,cFeatures)
        }
    //-->
    </script>
    </head>
    <body>
    <!--#include virtual="/header.inc" -->
    
    <!--#include virtual="/navigation.inc" -->
    
    		<div class="headerphoto"></div>
    		
    		<div style="text-align:center;font-size:xx-large;margin-top:100px;margin-bottom:100px">Thank you for your inquiry.
    </div> 
    <!-- end of Main Content -->										
    
    <!--#include virtual="/footer.inc" -->
    
    </body>
    </html>
    When I click my submit button, I'm getting this one:

    Acme Mail Confirmation

    Hello Friend,

    Thank you for visiting Acme Indian Arts Store. Also thank you for your feedback. If you have provided your email address, we will contact shortly.

    Thank you for your patronage.

    A message has been sent from cooks {AT} yahoo.com to webdevteacher {AT} gmail.com


    Can you please help me here that what I'm doing wrong and what should I do?

    Thanks.

    webnew
    Last edited by IanS; 7-10-09 at 03:56 PM. Reason: added code tags, blurred inline e-mail addresses.

  2. #2
    Former Spam Filter (EU) IanS's Avatar
    Join Date
    Mar 2004
    Location
    Washington (THE original UK one!)
    Posts
    12,964
    Rep Power
    30
    I don't think you've provided enough info here for assistance to be given.
    This is a Powweb customer
    helping Powweb customer forum.

    I am a customer just like you!!

    Some matters can only be answered by staff or support.
    Give it a go - ask here first!

  3. #3
    YvetteKuhns's Avatar
    Join Date
    Feb 2003
    Location
    Allentown, PA USA
    Posts
    15,244
    Rep Power
    34
    when I click on submit button, I'm not getting my confirmation form
    Confirmation form? Did you want a mail confirmation message to appear in a small window after the mail is sent? Why didn't you simply include the JavaScript code in the sendmail.pl file? The confirmation message could be an shtml file. You could also add a final print before closing your html tag to confirm that the mail was sent and include a link to go back to the home page or someplace.
    Yvette Kuhns
    Power Pages Web Design
    Customized Internet Advertising Solutions

  4. #4
    Just another mook Doc C's Avatar
    Join Date
    Mar 2006
    Location
    Southern CA
    Posts
    5,098
    Rep Power
    20
    Just be aware, people here don't do other people's homework.
    "You don't really understand human nature
    unless you know why a child on a merry-go-round will wave at his parents every time around
    -- and why his parents will always wave back."

    -William D. Tammeus

  5. #5
    Registered
    Join Date
    Jul 2009
    Location
    US
    Posts
    3
    Rep Power
    0
    When I click on submit button, I receive this confirmation below. But I'm trying to get confirmation with header and navigation. I don't know how to link my confirmation.shtml with sendmail.pl.


    Acme Mail Confirmation

    Hello Friend,

    Thank you for visiting Acme Indian Arts Store. Also thank you for your feedback. If you have provided your email address, we will contact shortly.

    Thank you for your patronage.

    A message has been sent from p--------y{at}yahoo.com to webdevteacher{at}gmail.com

    Quote Originally Posted by YvetteKuhns View Post
    Confirmation form? Did you want a mail confirmation message to appear in a small window after the mail is sent? Why didn't you simply include the JavaScript code in the sendmail.pl file? The confirmation message could be an shtml file. You could also add a final print before closing your html tag to confirm that the mail was sent and include a link to go back to the home page or someplace.
    I tried with adding my confirmation code to sendmail.pl ( after the ## HTML content lets user know we sent an email but getting an error. ) but did not work. Do I have any wrong code? or too many code?
    Last edited by IanS; 7-11-09 at 03:40 AM. Reason: Merged two posts.

  6. #6
    YvetteKuhns's Avatar
    Join Date
    Feb 2003
    Location
    Allentown, PA USA
    Posts
    15,244
    Rep Power
    34
    When I click on submit button, I receive this confirmation below. But I'm trying to get confirmation with header and navigation
    I tried with adding my confirmation code to sendmail.pl ( after the ## HTML content lets user know we sent an email but getting an error. ) but did not work.
    Did you try copying the header and navigation code rather than using the includes files? I realize this will be another file to remember to edit in the future, but the includes files may not be working. Using simple HTML inside your sendmail.pl would probably work better.

    Could you post what errors you are getting?
    Yvette Kuhns
    Power Pages Web Design
    Customized Internet Advertising Solutions

  7. #7
    Rick
    Join Date
    May 2002
    Location
    Minneapolis, MN
    Posts
    1,752
    Rep Power
    19
    Your Perl script needs to send the Content-Type header before the HTML code (or any other text) or it will crash the CGI handler on the server. Replace the first few lines with:
    Code:
    ## HTML content lets user know we sent an email
    print "Content-type: text/html\n\n";
    print "<html><head><title>$title</title><head>\n<body>\n\n";
    Rick Trethewey

  8. #8
    Registered
    Join Date
    Jul 2009
    Location
    US
    Posts
    3
    Rep Power
    0
    Code:
    #!/usr/bin/perl
    use CGI::Carp qw(fatalsToBrowser);
    
    $title= 'Acme Mail Confirmation';
    $to= 'webdevteacher@gmail.com';
    $from= 'p-------y@yahoo.com';
    $subject= 'Acme Mail Confirmation';
    open(MESSAGE, "|/usr/sbin/sendmail");
    ## MESSAGE Header
    print MESSAGE "To: $to\n";
    print MESSAGE "From: $from\n";
    print MESSAGE "Subject: $subject\n\n";
    close(MESSAGE);
    ## HTML content lets user know we sent an email
    print "Content-type: text/html\n\n";
    print "<html><head><title>$title</title><head>\n<body>\n\n";
    
    my $shtml = 'http://student345.webdev.scc-fl.edu/confirmation.shtml';
    print "Location: $shtml\n\n";
    exit;
    I tried this one, but its not working. After clicking Submit button, I'm getting this message.

    Location: http://student345.webdev.scc-fl.edu/confirmation.shtml


    Am I missing some code here? In my confirmation.shtml, now I'm not using include virtual.
    Last edited by IanS; 7-12-09 at 03:41 AM. Reason: Added code tags

  9. #9
    Former Spam Filter (EU) IanS's Avatar
    Join Date
    Mar 2004
    Location
    Washington (THE original UK one!)
    Posts
    12,964
    Rep Power
    30
    Please be aware, as doc said - we're not here to help you do your homework!
    This is a Powweb customer
    helping Powweb customer forum.

    I am a customer just like you!!

    Some matters can only be answered by staff or support.
    Give it a go - ask here first!

  10. #10
    Rick
    Join Date
    May 2002
    Location
    Minneapolis, MN
    Posts
    1,752
    Rep Power
    19
    You've changed your script and removed the embedded HTML. If you just want to show the user the confirmation page after the EMail has been sent, remove the code I posted above. You can't send a server response header message after you've begun to send content.
    Rick Trethewey

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •