I have a perl script which is working on most email servers, but my client has a gmail address and it is converting the text email to an non openable attachment on chrome, what needs to be changed? script attached 2 part. I am no expert just dangerous enough to get it to work. It works fine on safari. Part one
#!/usr/local/bin/perl #### # # Program: question1.pl # Cimmaron Design # 702 448-4927 # #### #### # # Image Uploading Routine # #### #### # # The libraries to use... CGI for the CGI functions used in print sta +tements. # Use 'perldoc CGI' to find out more about the CGI functions. # #### use CGI qw/:all/; #### # # Begin of the main code # #### #### # # The param function will determine if there was a CGI submission. # #### if (param) { #### # # This is where we want to be, print out a nice HTML header # and start to process the stuff that the server will send in # email to the user and the guys who are going to actually # fill the order. # #### print STDOUT header; print STDOUT start_html('View Sovereign Questionnaire'); #### # # Okay - next we will verify *all* the fields on the order # form are listed properly, and verify their correctness. # If those conditions are met, then we'll print out what the # email will look like, and save it off to a variable that we # can pipe to the email program. # #### $your_email_address = param('your_email_address'); $your_name = param('your_name'); $email_subject_line = param('email_subject_line'); $required_fields = param('required_fields'); $thank_you_title = param('thank_you_title'); $return_link_url = param('return_link_url'); $return_link_name = param('return_link_name'); $client_email = param('client_email'); $client_name = param('client_name'); $client_phone = param('client_phone'); $tell = param('tell'); $owned = param('owned'); $lookingfor = param('lookingfor'); $how = param('how'); $fenced = param('fenced'); $time = param('time'); $sex = param('sex'); $house = param('house'); $out = param('out'); $comp = param('comp'); $comments = param('comments'); #### # # Now - to verify each of the *required* entries... the # undefined ones weren't used in what the user listed... # We'll go through all the errors, and then print out what # we find, instead of breaking if there's just one and not # showing any others we might find as well, to make it more # usable. # #### $err_no = 0; if ( ! defined($your_email_address) ) { $err[$err_no++]="Invalid hidden fields 'your_email_address'\n" +; } if ( ! defined($your_name) ) { $err[$err_no++]="Invalid hidden fields 'your_name'\n"; } if ( ! defined($email_subject_line) ) { $err[$err_no++]="Invalid hidden fields 'email_subject_line'\n" +; } if ( ! defined($thank_you_title) ) { $err[$err_no++]="Invalid hidden fields 'thank_you_title'\n"; } if ( ! defined($return_link_url) ) { $err[$err_no++]="Invalid hidden fields 'return_link_url'\n"; } if ( ! defined($return_link_name) ) { $err[$err_no++]="Invalid hidden fields 'return_link_name'\n"; } #### # # User information next... # #### if ( ! defined($client_email) ) { $err[$err_no++]="You must enter an email address\n"; } else { if ( $client_email eq "" ) { $err[$err_no++]="You must enter an email address\n"; } } if ( ! defined($client_name) ) { $err[$err_no++]="You must enter a name\n"; } else { if ( $client_name eq "" ) { $err[$err_no++]="You must enter a name\n"; } } if ( ! defined($client_phone) ) { $err[$err_no++]="You must enter a phone number\n"; } else { if ( $client_name eq "" ) { $err[$err_no++]="You must enter a phone number\n"; } } #### # # Verifications complete. Next we check if there were # any errors. If there were, print them, and exit, if not, # then print out what we're here after - the order form. # #### if ( $err_no > 0 ) { print STDOUT h2({-align=>'center'}, font( {-color=>"#AF0000"}, "Submitted Questionnaire - Sovereign +Brittanys - errors" ) ), "\n"; print STDOUT hr( {-noshade} ), "\n"; print STDOUT "<UL>\n"; for ( $i = 0 ; $i < $err_no; $i++ ) { print STDOUT li($err[$i]), "\n"; } print STDOUT "</UL>\n"; print STDOUT end_html, "\n"; exit; } #### # # So - lets print out some HTML to show them what they ordered, # and get verification that it's all good. # #### print STDOUT h2({-align=>'center'}, font( {-color=>"#AF0000"}, "Submitted Sovereign Questionnaire" ) ), +"\n"; print STDOUT hr( {-noshade} ), "\n"; print STDOUT "<pre>\n"; if ($imageError) { my @vars = sort(keys(%ENV)); #foreach(@vars) { # $ENV{$_} ||= qq~›~; #print qq~ # # $of\$ENV{$_}$cf # $of$ENV{$_}$cf # #~; #} print STDOUT " Upload Error: $returned\n"; } print STDOUT "Email Address: $client_email\n"; print STDOUT "Your Name: $client_name\n"; print STDOUT "Your Phone: $client_phone\n"; print STDOUT "____________________________________________________ +_______________________\n"; if ( length($tell) > 1 ) { print STDOUT "Please tell us a little about your home and fami +ly (including number of children and ages at home). \n"; print STDOUT "$tell\n"; print STDOUT "____________________________________________________ +_______________________\n"; } if ( length($owned) > 1 ) { print STDOUT "Have you owned a dog/Brittany (raised a puppy)? +\n"; print STDOUT "$owned\n"; print STDOUT "____________________________________________________ +_______________________\n"; } if ( length($lookingfor) > 1 ) { print STDOUT "What are you looking for in a Brittany? \n"; print STDOUT "$lookingfor\n"; print STDOUT "____________________________________________________ +_______________________\n"; } if ( length($how) > 1 ) { print STDOUT "If you are looking for a hunting dog, how often +do you hunt? Will you be using a professional trainer? \n"; print STDOUT "$how\n"; print STDOUT "____________________________________________________ +_______________________\n"; } if ( length($fenced) > 1 ) { print STDOUT "Do you have a fenced in yard? \n"; print STDOUT "$fenced\n"; print STDOUT "____________________________________________________ +_______________________\n"; } if ( length($sex) > 1 ) { print STDOUT "Are you looking for a male or female, or open to + either? \n"; print STDOUT "$sex\n"; print STDOUT "____________________________________________________ +_______________________\n"; } if ( length($house) > 1 ) { print STDOUT "Where will this puppy/dog live? Where will it st +ay when you are not home? \n"; print STDOUT "$house\n"; print STDOUT "____________________________________________________ +_______________________\n"; } if ( length($out) > 1 ) { print STDOUT "Will there be someone home during the day to tak +e the puppy out? \n"; print STDOUT "$out\n"; print STDOUT "____________________________________________________ +_______________________\n"; } if ( length($comp) > 1 ) { print STDOUT "Do you have any interest in competing with your +dog (ie. conformation shows, hunt tests, field trials, agility, obedience, rally, lure coursing, barn hunt, etc)? \n"; print STDOUT "$comp\n"; print STDOUT "____________________________________________________ +_______________________\n"; } if ( length($comments) > 1 ) { print STDOUT "Additional Comments:\n"; print STDOUT "$comments\n"; } print STDOUT "</pre>\n"; print STDOUT "<form action=\"question2.pl\" method=\"POST\">\n"; ##### # # Now, for the next cgi in line, we'll need ALL # the elements of the last page, to print out on the # email that's going to the address specified in the # html file, and the one specified on the form (the client) # #### if (!$imageError) { print STDOUT "<input type=\"hidden\" name=\"upload_name\" valu +e=\"$returned\">\n"; print STDOUT "<input type=\"hidden\" name=\"upload_type\" valu +e=\"$fileType\">\n"; } print STDOUT "<input type=\"hidden\" name=\"your_email_address\" v +alue=\"$your_email_address\">\n"; print STDOUT "<input type=\"hidden\" name=\"your_name\" value=\"$y +our_name\">\n"; print STDOUT "<input type=\"hidden\" name=\"email_subject_line\" v +alue=\"$email_subject_line\">\n"; print STDOUT "<input type=\"hidden\" name=\"required_fields\" valu +e=\"$required_fields\">\n"; print STDOUT "<input type=\"hidden\" name=\"thank_you_title\" valu +e=\"$thank_you_title\">\n"; print STDOUT "<input type=\"hidden\" name=\"return_link_url\" valu +e=\"$return_link_url\">\n"; print STDOUT "<input type=\"hidden\" name=\"return_link_name\" val +ue=\"$return_link_name\">\n"; print STDOUT "<input type=\"hidden\" name=\"client_email\" value=\ +"$client_email\">\n"; print STDOUT "<input type=\"hidden\" name=\"client_name\" value=\" +$client_name\">\n"; print STDOUT "<input type=\"hidden\" name=\"client_phone\" value=\ +"$client_phone\">\n"; print STDOUT "<input type=\"hidden\" name=\"client_phone\" value=\ +"$client_phone\">\n"; print STDOUT "<input type=\"hidden\" name=\"tell\" value=\"$tell\" +>\n"; print STDOUT "<input type=\"hidden\" name=\"owned\" value=\"$owned +\">\n"; print STDOUT "<input type=\"hidden\" name=\"lookingfor\" value=\"$ +lookingfor\">\n"; print STDOUT "<input type=\"hidden\" name=\"how\" value=\"$how\">\ +n"; print STDOUT "<input type=\"hidden\" name=\"fenced\" value=\"$fenc +ed\">\n"; print STDOUT "<input type=\"hidden\" name=\"time\" value=\"$time\" +>\n"; print STDOUT "<input type=\"hidden\" name=\"sex\" value=\"$sex\">\ +n"; print STDOUT "<input type=\"hidden\" name=\"house\" value=\"$house +\">\n"; print STDOUT "<input type=\"hidden\" name=\"out\" value=\"$out\">\ +n"; print STDOUT "<input type=\"hidden\" name=\"comp\" value=\"$comp\" +>\n"; print STDOUT "<input type=\"hidden\" name=\"comments\" value=\"$co +mments\">\n"; print STDOUT "<hr><div align=\"center\">\n"; print STDOUT "<input type=\"submit\" name=\"submit\" value=\"OK\"> +\n"; print STDOUT "<input type=\"button\" name=\"back\" value=\"Back\" +onclick=\"history.back()\">\n"; print STDOUT "</div>\n"; } else { #### # # Somehow they got here without going to the order form html # page... so lets just print out an error and tell them to hit # a link to the submissionform.html page # #### print STDOUT header; print STDOUT start_html('Error'); print STDOUT h1( {-align=>'center'}, font( {-color=>'#AF0000'}, "Error") ), "\n"; print STDOUT hr( {-noshade} ), "\n"; print STDOUT div( {-align=>'center'}, "Please return to the ", a({-href=>'questionnaire18.html'}, "Questionnaire") , "\n", "instead of calling this CGI directly\n"), "\n"; } #### # # That's all folks :-) # #### print STDOUT end_html, "\n";
Part 2
#!/usr/local/bin/perl #### # # Program: svetime2.pl # Cimmaron Design 7/2017 # 720 448-4927 # #### #### # # The libraries to use... CGI for the CGI functions used in print sta +tements. # Use 'perldoc CGI' to find out more about the CGI functions. # #### use CGI qw/:all/; #### # # The param function will determine if there was a CGI submission. # #### if (param) { #### # # This is where we want to be, print out a nice HTML header # and start to process the stuff that the server will send in # email to the user and the guys who are going to actually # fill the inquiry . # #### print STDOUT header; print STDOUT start_html('Sovereign Brittany Questionnaire'); #### # # Okay - next we will verify *all* the fields on the order # form are listed properly, and verify their correctness. # If those conditions are met, then we'll print out what the # email will look like, and save it off to a variable that we # can pipe to the email program. # #### $your_email_address = param('your_email_address'); $your_name = param('your_name'); $email_subject_line = param('email_subject_line'); $required_fields = param('required_fields'); $thank_you_title = param('thank_you_title'); $return_link_url = param('return_link_url'); $return_link_name = param('return_link_name'); $client_email = param('client_email'); $client_name = param('client_name'); $client_phone = param('client_phone'); $tell = param('tell'); $owned = param('owned'); $lookingfor = param('lookingfor'); $how = param('how'); $fenced = param('fenced'); $time = param('time'); $sex = param('sex'); $house = param('house'); $out = param('out'); $comp = param('comp'); $comments = param('comments'); #### # # So - lets print out some HTML to show them what they ordered, # and get verification that it's all good. # #### $inquiry = ""; $inquiry .= " Email: $client_email\n"; $inquiry .= " Name: $client_name\n"; $inquiry .= " Phone: $client_phone\n"; $inquiry .= " ---------------------------------------- +------------------\n"; if ( length($tell) > 1 ) { $inquiry .= "Please tell us a little about your home and famil +y (including number of children and ages at home). \n"; $inquiry .= "$tell\n"; $inquiry .= "_____________________________________________________ +______________________\n"; } if ( length($owned) > 1 ) { $inquiry .= "Have you owned a dog/Brittany (raised a puppy)? \ +n"; $inquiry .= "$owned\n"; $inquiry .= "_____________________________________________________ +______________________\n"; } if ( length($lookingfor) > 1 ) { $inquiry .= "What are you looking for in a Brittany? \n"; $inquiry .= "$lookingfor\n"; $inquiry .= "_____________________________________________________ +______________________\n"; } if ( length($how) > 1 ) { $inquiry .= "If you are looking for a hunting dog, how often d +o you hunt? Will you be using a professional trainer? \n"; $inquiry .= "$how\n"; $inquiry .= "_____________________________________________________ +______________________\n"; } if ( length($fenced) > 1 ) { $inquiry .= "Do you have a fenced in yard? \n"; $inquiry .= "$fenced\n"; $inquiry .= "_____________________________________________________ +______________________\n"; } if ( length($sex) > 1 ) { $inquiry .= "Are you looking for a male or female, or open to +either? \n"; $inquiry .= "$sex\n"; $inquiry .= "_____________________________________________________ +______________________\n"; } if ( length($house) > 1 ) { $inquiry .= "Where will this puppy/dog live? Where will it stay when you are not home? \n"; $inquiry .= "$house\n"; $inquiry .= "_____________________________________________________ +______________________\n"; } if ( length($out) > 1 ) { $inquiry .= "Will there be someone home during the day to take + the puppy out? \n"; $inquiry .= "$out\n"; $inquiry .= "_____________________________________________________ +______________________\n"; } if ( length($comp) > 1 ) { $inquiry .= "Do you have any interest in competing with your d +og (ie. conformation shows, hunt tests, field trials, agility, obedience, rally, lure coursing, barn hunt, etc)? \n"; $inquiry .= "$comp\n"; $inquiry .= "_____________________________________________________ +______________________\n"; } if ( length($comments) > 1 ) { $inquiry .= "Additional Comments:\n"; $inquiry .= "$comments\n"; $inquiry .= "_____________________________________________________ +______________________\n"; } #### # # Now we've got the order as it was displayed to the user # in the last script stuck inside a variable. We can send # that out in an email to the required email addresses, *and* # print it on the screen for the user again to make sure its # perfect, but there's no going back now... # #### print STDOUT h3({-align=>'center'}, font( {-color=>"#AF0000"}, "Sovereign Brittany Questionnaire" ) ), " +\n"; print STDOUT hr( {-noshade} ), "\n"; print STDOUT "<pre>\n"; print STDOUT $inquiry; print STDOUT "</pre>\n"; print STDOUT "<hr><div align=\"center\">\n"; print STDOUT "<h2 align=\"center\">$thank_you_for_your_filling_out +_our_questionnaire</h2>\n"; #### # # On a windows system, the mail command may need to change # I don't have one to test with, but the lines that say # "open ( MAILx" are the ones that you'll need to fuss with... # #### if ( open (MAIL1, "| mail -s \"$email_subject_line\" $client_email +") != 0 ) { print MAIL1 $inquiry; close MAIL1; } else { print STDOUT "<p>Mail failed to $client_email</p>\n"; } if ( open (MAIL2, "| mail -s \"$email_subject_line\" $your_email_a +ddress") != 0 ) { print MAIL2 $inquiry; close MAIL2; print STDOUT "<p>Mail sent to $your_email_address (to process +this inquiry)</p>\n"; } else { print STDOUT "<p>Mail FAILED to $your_email_address (Will NOT +process this inquiry)</p>\n"; } print STDOUT "<p>click <a href=\"$return_link_url\">$return_link_n +ame</a> to return.</p>\n"; print STDOUT "</div>\n"; } else { #### # # Somehow they got here without going to the order form html # page... so lets just print out an error and tell them to hit # a link to the contact.html page # #### print STDOUT header; print STDOUT start_html('Error'); print STDOUT h1( {-align=>'center'}, font( {-color=>'#AF0000'}, "Error") ), "\n"; print STDOUT hr( {-noshade} ), "\n"; print STDOUT div( {-align=>'center'}, "Please return to the ", a({-href=>'index.html'}, "Sovereign Brittanys.") , "\n", "instead of calling this CGI directly\n"), "\n"; } #### # # That's all folks :-) # #### print STDOUT end_html, "\n";

In reply to pearl script working but is changing to attachment by cwebber1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.