title: Sending email using Perl using sendmail
body: <p>I am following the example from <a href="http://www.tutorialspoint.com/perl/perl_sending_email.htm" rel="noreferrer">this website</a> to send an email using Perl. The code looks like so:</p>
  
  <pre><code>my $hostname = `hostname`;
  my $this_day = `date`;
  my $email = "i.h4d35\@gmail.com";
  my $to = "$email";
  my $from = "admin\@$hostname";
  my $subject = "SCHEDULE COMPLETE - $this_day";
  my $message = "Student schedule for today, completed for the following students: \n\n$names\n\nHave a nice day...";
  open(MAIL, "|/usr/sbin/sendmail -t");
  print MAIL "To: $to\n";
  print MAIL "From: $from\n";
  print MAIL "Subject: $subject\n\n";
  print MAIL $message;
  close(MAIL);
  </code></pre>
  
  <p>The mail gets sent but the subject appears in the body of the mail and the email has no subject. How do I fix this?</p>
  
  <p>PS: Have not gotten around to using <code>MIME::Lite</code> yet as I am still learning this.</p>