mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-06-02 05:59:40 +08:00
feat: use pnpm
This commit is contained in:
@@ -17,8 +17,8 @@ async function email(message, env, ctx) {
|
||||
const parsedEmail = await parser.parse(rawEmail);
|
||||
|
||||
const { success } = await env.DB.prepare(
|
||||
`INSERT INTO mails (source, address, message) VALUES (?, ?, ?)`
|
||||
).bind(message.from, message.to, parsedEmail.html).run();
|
||||
`INSERT INTO mails (source, address, subject, message) VALUES (?, ?, ?, ?)`
|
||||
).bind(message.from, message.to, parsedEmail.subject || "", parsedEmail.html).run();
|
||||
if (!success) {
|
||||
message.setReject(`Failed save message to ${message.to}`);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ api.get('/api/mails', async (c) => {
|
||||
return c.json({ "error": "No address" }, 400)
|
||||
}
|
||||
const { results } = await c.env.DB.prepare(
|
||||
`SELECT id, source, message FROM mails where address = ? order by id desc limit 10`
|
||||
`SELECT id, source, subject, message FROM mails where address = ? order by id desc limit 10`
|
||||
).bind(address).all();
|
||||
return c.json(results);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user