title: varchar as a foreign key constraint
body: <p>I am trying to add a foreign key constraint using a varchar instead of usual int</p>
  
  <p>table users:</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `users` (
  `userId` int(11) NOT NULL AUTO_INCREMENT,
  `userFName` varchar(60) NOT NULL,
  `userLName` varchar(60) NOT NULL,
  `userEmail` varchar(100) NOT NULL,
  `userPassword` varchar(50) NOT NULL,
  PRIMARY KEY (`userId`)
  );
  </code></pre>
  
  <p>table mail:</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `mail` (
  `mailId` int(11) NOT NULL AUTO_INCREMENT,
  `sender` varchar(100) NOT NULL,
  `receiver` varchar(100) NOT NULL,
  `mailSubject` varchar(255) NOT NULL,
  `mailContent` varchar(255) NOT NULL,
  `mailSendDate` datetime NOT NULL,
  CONSTRAINT fk_sender FOREIGN KEY (sender) REFERENCES users(userEmail),
  CONSTRAINT fk_receiver FOREIGN KEY (receiver) REFERENCES Users(userEmail),    
  PRIMARY KEY (`mailId`)
  );
  </code></pre>
  
  <p>I get an error: foreign key constraint fail</p>