Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@tellimer/mailable
Advanced tools
Readme
Allows you to create React components that render to email HTML
import React from 'react'
import { Components, Mailable } from '@tellimer/mailable'
export class ExampleMailable extends Mailable {
// This is required
subject = 'Test'
// This is required, can be just a string (containing email)
from = {
name: 'Tellimer Test',
email: 'test@test.com',
}
// OR from = 'test@test.com'
// Does not have to return a promise, but allows for it
async view () {
const somethingElse = await new Promise((resolve) => setTimeout(() => resolve('hello'), 500))
return <div>This is an email!</div>
}
}
// .........
const mailable = new ExampleMailable()
mailable.render().then(html => console.log(html))
Would output the following HTML
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office" style="margin: 0; padding: 0; font-size: 16px; color: #242424; font-family: Arial, Helvetica, Verdana, Tahoma, sans-serif;">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="x-apple-disable-message-reformatting">
<title>Test</title>
<!--[if mso]>
<noscript>
<xml>
<o:OfficeDocumentSettings>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
</noscript>
<![endif]-->
</head>
<body style="background: #eaeaea; margin: 0; padding: 0; font-size: 16px; color: #242424; font-family: Arial, Helvetica, Verdana, Tahoma, sans-serif;">
<div data-reactroot>This is an email!</div>
</body>
</html>
First, you must create some versions of the email. These versions must be MailableVersion
, which extends the Mailable
class. The only new property in this class, is the version
property, which is required.
Then, you must create a class that extends MailableVersionFactory
. This will contain a method version
that returns the correct MailableVersion
to send to a person.
import React from 'react'
import {
Components,
Mailable,
MailableVersion,
MailableVersionFactory,
Personalization
} from '@tellimer/mailable';
const { Email } = Components
export class Versioned extends MailableVersionFactory {
version(personalization: Personalization) {
return parseInt(personalization.customArgs?.userId, 10) % 2 === 0 ? new VersionA() : new VersionB()
}
}
class VersionA extends MailableVersion {
version = 'A'
subject = 'this is a subject for A'
from = {email: 'test@test.com'}
view() {
return (
<Email>
<div>
for version B
</div>
</Email>
)
}
}
class VersionB extends MailableVersion {
version = 'B'
subject = 'this is a subject for B'
from = {email: 'test@test.com'}
view() {
return (
<Email>
<div>
for version B
</div>
</Email>
)
}
}
Run storybook to see more information!
yarn storybook
<Email header?={React.ReactComponent} footer?={React.ReactComponent}>
<EmailRow>
<EmailCol>
FAQs
Allows you to create React components that render to email HTML
The npm package @tellimer/mailable receives a total of 0 weekly downloads. As such, @tellimer/mailable popularity was classified as not popular.
We found that @tellimer/mailable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.