Hello, I am using sendmail to send form data to 3 emails. Then the user is sent to a confirmation page. It works for me, and others as I am receiving emails, but for a few others it does not. They are being sent to the confirmation page but no emails are ever sent out. Am I doing something wrong, or is this server related?

#!/usr/bin/perl use CGI qw/:standard/; $CGI::POST_MAX=1024 * 1; #$CGI::Validate::IgnoreNonMatchingFields = 1; $fstname = substr param ('first'), 0, 40; $lstname = substr param ('last'), 0, 40; $adda = substr param ('1ad1a'), 0, 60; $addb = substr param ('1ad1b'), 0, 60; $city = substr param ('1ad2'), 0, 60; $state = substr param ('1ad3'), 0, 20; $zip = substr param ('1ad4'), 0, 5; $email = substr param ('eadd'), 0, 70; $phone = substr param ('pnum'), 0, 16; $residence = substr param ('residence'), 0, 9; $yardtype = substr param ('yardtype'), 0, 16; $yardtypeother = substr param ('yardtypeother'), 0, 40; $landlord = substr param ('landlord'), 0, 40; $preadda = substr param ('2ad1'), 0, 60; $precity = substr param ('2ad2'), 0, 60; $prestate = substr param ('2ad3'), 0, 20; $prezip = substr param ('2ad4'), 0, 5; $alone = substr param ('alone'), 0, 14; $household = substr param ('household'), 0, 100; $vet = substr param ('vet'), 0, 45; $pet = substr param ('pet'), 0, 3; $petname = substr param ('petnme'), 0, 30; $currentpets = substr param ('currentpets'), 0, 60; $previouspets = substr param ('previouspets'), 0, 60; $references = substr param ('references'), 0, 140; $ok = substr param ('ok'), 0, 7; ## Clear out unwanted characters $fstname =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $lstname =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $adda =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $addb =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $city =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $state =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $zip =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $email =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $phone =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $residence =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $yardtype =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $landlord =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $preadda =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $precity =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $prestate =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $prezip =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $alone =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $household =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $vet =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $pet =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $petname =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $currentpets =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $previouspets =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $references =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $ok =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $email =~ tr/[A-Z]/[a-z]/; ## Check email address if (($email ne "") && ($email !~ m/[\w]+@[\w]+\.[\w]+/)) { print "Content-type: text/html\n\n"; print "error (Your email is invalid, please check and resubmit you +r application)</ br></ br>"; exit; } ## Check data $total_form = "$fstname$lstname$email"; if (length($total_form) < 25) { print "Content-type: text/html\n\n"; print "error (The form was incomplete, please check that you fill +ed in your full first and last name, and email address, then resubmit + your application.)</ br></ br>"; exit; } # residence replace with response ##if ($residence eq "1") ## { ## $residence = "House" ## } ##if ($residence eq "2") ## { ## $residence = "Apartment" ## } $recipient = "email1\@emailsrv1, email2\@emailsrv2, email3\@emailsrv3" +; ## Create the email message body $email_message = qq{To: $recipient Subject: Adoption Application From: $fstname $lstname<$email> First name: $fstname Last name: $lstname Current address: $adda $addb $city $state $zip _________________________________________________ Email address: $email Phone number: $phone Type of residence: $residence Yard: $yardtype Landlord contact info: $landlord Previous address: $preadda $precity $prestate $prezip How many hours will pet be alone: $alone Name and age of people in household: $household Veterinarian: $vet Dog or Cat: $pet Name of pet requested: $petname Current pets: $currentpets Previous pets: $previouspets References: $references Aggree to consent form: $ok }; ## Send email $mailprog = '/usr/sbin/sendmail'; open (MAIL, "|$mailprog -t"); print MAIL $email_message; close (MAIL); print "Location: application-submitted \n\n"; exit; __END__

In reply to sendmail working for me but not another by kickingchicken

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.