I am using the following code:
cat - emailbody.txt <<EOF | /usr/sbin/sendmail -oi -t
From: <PersonB@xyz.com>
To: <PersonA@xyz.com>
Subject: Testmail
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
EOF
where emailbody.txt is a file with the contents of the email and PersonB@xyz.com and PersonA@xyz.com are both valid email addresses. My question is, that when I run this command, sendmail executes successfully and sends a mail to PersonA@xyz.com. However at no point does it ask for the credentials of PersonB@xyz.com. Shouldn't that check be executed before the mail is sent out? What prevents me from impersonating another person's email address to send out false mails. Is there a rationale for this behavior?