
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
@pubsweet/component-email-templating
Advanced tools
The email-templating component contains an EmailTemplate class with one main instance method sendEmail for sending the email using the send-email component from PubSweet.
sendEmail():
send-email component from PubSweet to actually send the email based on the Email properties passed in the constructorThe Email class also provides a constructor whose properties will be used when sending the email:
type: a String that can be either user or system which can be used in the unsubscribe processfromEmail: a String indicating the from name and from email address: Coko <team@coko.foundation>toUser: an Object with two properties: email and name. The name property will be used when addressing the recipient in the email content - for example: "Dear Dr. Rachel Smith".cc: can be either a string containing an email address, or an array of string with email addressesbcc: can be either a string containing an email address, or an array of string with email addressescontent: an Object which contains properties about the email:
subjectparagraph: the main text part of the email body which informs the recipientsignatureName - the name which will appear in the signaturectaLink - the URL which will be placed in the buttonctaText - the text which appears on the buttonunsubscribeLinksignatureJournal - the journal or company name which will appear in the signaturebodyProps:
hasLink: a boolean which indicates if the email body contains a CTA (big button) or nothasIntro: a boolean which indicates if the email body contains the "Dear Dr. John" introduction or not.hasSignature: a boolean which indicates if the email body contains a typical "Kind regards," signature or notConfig
In order to use this component, you need the to add the following data in your main config file:
journal: {
name: 'Coko Foundation',
staffEmail: 'Coko <team@coko.foundation>',
logo: 'https://coko.foundation/wp-content/uploads/2017/11/logo-coko.png',
ctaColor: '#EE2B77', // the color of the email button
logoLink: 'https://coko.foundation/',
publisher: 'Coko Foundation', // this will appear in the email footer
privacy: '', // a text containing information about the privacy policy that will appear in the email footer
address: '2973 16th St., Suite 300, San Francisco, CA 94103', // the address in the footer
footerText: 'You have received this email in regards to the account creation, submission, or peer review process of a paper submitted to a journal published by Coko Foundation.'
},
Dependencies
Notifications
These are the most basic emails, which contain at least a piece of text, called a paragraph, and may or may not contain an intro, an action button and a signature.

const EmailTemplate = require('@pubsweet/component-email-template')
const config = require('config')
const { name: journalName, fromEmail: staffEmail } = config.get('journal')
const paragraph = `We are please to inform you that the manuscript has passed the technical check process and is now submitted. Please click the link below to access the manuscript.`
const sendNotifications = ({ user, editor, collection, fragment }) => {
const email = new EmailTemplate({
type: 'user',
fromEmail,
toUser: {
email: user.email,
name: `${user.lastName}`,
},
content: {
ctaText: 'MANUSCRIPT DETAILS',
signatureJournal: journalName,
signatureName: `${editor.name}`,
subject: `${collection.customId}: Manuscript Update`,
paragraph,
unsubscribeLink: `http://localhost:3000/unsubscribe/${user.id}`,
ctaLink: `http://localhost:3000/projects/${collection.id}/versions/${fragment.id}/details`,
},
bodyProps: {
hasLink: true,
hasIntro: true,
hasSignature: true,
},
})
return email.sendEmail()
}
Reviewer Invitation This email template is specific to Hindawi and it requires some data that might not be available in other PubSweet apps.

FAQs
Send journal emails using templates from xPub/PubSweet
We found that @pubsweet/component-email-templating demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.