Devlin Technical Consulting Home
325 S. Washington Ave. #339, Kent, WA 98032
PH: (253)272-5743 email: jdevlin@stadiumdistrict.com

Send an e-mail in your Perl CGI script

 

# + + +  + + +  + + +  + + +  + + +  + + +  + + +  + + +  + + #
# + + +  + + +  + + +  + + +  + + +  + + +  + + +  + + +  + + #
sub send_mail{
    # an e-mail for automated submission response

    my @myfile;#variable for reading the form letter
    my $line;#each line of the file

    #predefined application specific global variables
    #  $form_data{e_mail}
    #  $form_data{account_number}

    # $mailprog defines the location of your sendmail program on your unix
    # system.                                                             
    my $mailprog = '/usr/lib/sendmail';
    my $form_letter_file = '/site_data/submit_response_letter.txt';

    #get the form letter
	open (F, "<$document_root$form_letter_file")  or warn "Can't open file $form_letter_file\n";
	@myfile= <F>;
	close(F);		#ignore return value

    # Open The Mail Program
    open(MAIL,"|$mailprog -t");

    print MAIL "To: $form_data{e_mail}\n";
    print MAIL qq[From: My Company Name <myname\@mycompany.com> \n];
    print MAIL "Subject:  Submital confirmation \n\n";

    print MAIL "Your account number is: $form_data{account_number}\n\n";
    
    foreach $line (@myfile)
		{print MAIL "$line";}
    close (MAIL);
}

# + + +  + + +  + + +  + + +  + + +  + + +  + + +  + + +  + + #
# + + +  + + +  + + +  + + +  + + +  + + +  + + +  + + +  + + #




 
     
   







Page Modified 2/16/00