Skip to content

Commit

Permalink
info@mg.swanfactory.online
Browse files Browse the repository at this point in the history
  • Loading branch information
drernie committed Jan 27, 2025
1 parent 4f29b48 commit 299a313
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion islands/EmailButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function SendEmailButton() {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
to: "info@swanfactory.online",
to: "ernest@drernie.com",
subject: "Hello from Deno Fresh",
text: "This is a test email sent from a Deno Fresh application.",
}),
Expand Down
6 changes: 4 additions & 2 deletions utils/mail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@ const mailgun = new Mailgun({
region: "us", // or "eu" based on your Mailgun account
});

console.log("Mailgun client:", mailgun);

export async function sendEmail(
to: string,
subject: string,
text: string,
from: string = "info@swanfactory.online",
from: string = "info@mg.swanfactory.online",
) {
console.log(`Sending email to ${to}...`);
const response = await mailgun.send({ to, from, subject, text });
if (response.ok) {
console.log(`Email sent to ${to}`);
console.log(`Email sent to ${to}`, response);
} else {
console.error(
`Error[${response.status}]: ${response.statusText}`,
Expand Down

0 comments on commit 299a313

Please sign in to comment.