--
-- Host: localhost    Database: tempmail
-- ------------------------------------------------------


--
-- Current Database: `tempmail`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `tempmail` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */;

USE `tempmail`;

--
-- Table structure for table `emails`
--

CREATE TABLE `emails` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `inbox_id` bigint(20) NOT NULL,
  `from_addr` varchar(320) NOT NULL DEFAULT '',
  `to_addr` varchar(320) NOT NULL DEFAULT '',
  `subject` varchar(1000) NOT NULL DEFAULT '',
  `body_text` mediumtext DEFAULT NULL,
  `body_html` mediumtext DEFAULT NULL,
  `received_at` datetime NOT NULL DEFAULT current_timestamp(),
  `seen` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `inbox_id` (`inbox_id`),
  CONSTRAINT `fk_email_inbox` FOREIGN KEY (`inbox_id`) REFERENCES `inboxes` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `emails`
--

INSERT INTO `emails` VALUES (1,1,'tester@example.com','fiz8nz2q9q@tempmail.local','Welcome!','Your temp mail works.\r\n','<h2>Welcome!</h2><p>Your temp mail works.</p><p><b>It works! 🎉</b></p>\r\n','2026-08-06 15:34:56',1),(2,9,'tester@example.com','kqm80dz4pu@tempmail.local','Live check','If you see this, receiving works.\r\n','<h2>Live check</h2><p>If you see this, receiving works.</p><p><b>It works! 🎉</b></p>\r\n','2026-08-07 10:24:30',1);


