Skip to content

Instantly share code, notes, and snippets.

@gr2m
Last active January 28, 2021 15:10
Show Gist options
  • Save gr2m/5463552 to your computer and use it in GitHub Desktop.
Save gr2m/5463552 to your computer and use it in GitHub Desktop.
Imagine you could send emails with JavaScript, multipart, and with attachments?! How would the code look like? This is what I came up with. Forks & comments much appreciated! #nobackend #dreamcode
// send text email
sendEmail({
subject: "Hello, World!",
text: "This mail has been sent from the frontend",
to: "joe@exam.pl"
})
// send multipart text / html email
sendEmail({
subject: "Hello, World!",
text: "This mail has been sent from the frontend",
html: "<p>This mail has been sent from the frontend</p>",
to: "joe@exam.pl"
})
// send multipart with attachment
sendEmail({
subject: "Hello, World!",
text: "This mail has been sent from the frontend",
html: "<p>This mail has been sent from the frontend</p>",
to: "gregor@martynus.net",
attachments: [
convert( document.body ).to("screenshot.png"),
{ filename: "info.text", data: "Some info about the page"}
]
})
@Mackenzie-Frey
Copy link

@sudharsan203, It says #dreamcode at the top. Based upon this and other research I've completed, I don't believe this is possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment