feat: add email helper module using useSend SDK
This commit is contained in:
@@ -3,3 +3,6 @@ DATABASE_URL="postgres://user:password@host:port/db-name"
|
|||||||
|
|
||||||
SERVER_URL="http://localhost:8080"
|
SERVER_URL="http://localhost:8080"
|
||||||
PUBLIC_SERVER_WS_URL="ws://localhost:8080"
|
PUBLIC_SERVER_WS_URL="ws://localhost:8080"
|
||||||
|
|
||||||
|
# Email (useSend)
|
||||||
|
USESEND_API_KEY="us_your_api_key_here"
|
||||||
|
|||||||
22
web/src/lib/server/email.ts
Normal file
22
web/src/lib/server/email.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { UseSend } from 'usesend-js';
|
||||||
|
|
||||||
|
const usesend = new UseSend(process.env.USESEND_API_KEY!);
|
||||||
|
|
||||||
|
const EMAIL_FROM = 'noreply@app.droidclaw.ai';
|
||||||
|
|
||||||
|
export async function sendEmail({
|
||||||
|
to,
|
||||||
|
subject,
|
||||||
|
text
|
||||||
|
}: {
|
||||||
|
to: string;
|
||||||
|
subject: string;
|
||||||
|
text: string;
|
||||||
|
}) {
|
||||||
|
return usesend.emails.send({
|
||||||
|
to,
|
||||||
|
from: EMAIL_FROM,
|
||||||
|
subject,
|
||||||
|
text
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user