@styfrombrest/mailer
v1.0.1
Published
NodeJS mailer
Readme
@styfrombrest/mailer
Internal mailer for my pet projects.
It uses nodemailer under the hood to send an email from nodejs script.
Usage:
const result = await sendMail(config: ISendMailerOptions, mailOptions: IMailOptions);
interface IMailOptions {
from: string;
to: string;
subject?: string;
text?: string;
html?: string;
}interface ISendMailerOptions {
host: string;
port: number;
secure?: boolean;
auth: {
user: string;
pass: string;
}
}Troubleshooting:
- for yandex
IMailOptions.frommust be the same asISendMailerOptions.auth.useotherwise it won't accept email to send
Releasing
Every push to master triggers
the release workflow. It installs dependencies,
builds the package, runs semantic-release, publishes the public package to npm,
and creates the matching vX.Y.Z Git tag and GitHub release.
The conventional commit type controls the release size:
feat: ...creates a minor release.fix: ...creates a patch release.- A commit with
BREAKING CHANGE:creates a major release. - Any other commit still creates a patch release, so every push containing new commits produces a release.
To request a minor release, use a feat: commit and push it to master:
git commit -m "feat: add attachment support"
git push origin masterTo request a major release, add a BREAKING CHANGE: footer separated from the
commit subject by a blank line:
git commit -m "feat: change the sendMail API" \
-m "BREAKING CHANGE: sendMail now requires a transport argument"
git push origin mastersemantic-release analyzes every commit since the previous release and uses the
highest required version change. For example, a push containing both fix: and
feat: commits creates a minor release, while any breaking-change commit makes
it a major release.
Do not manually change the version in package.json, create release tags, or run
npm publish. semantic-release derives the next version from Git history. With
the existing v1.0.0 tag, the first automated release will be at least 1.0.1.
One-time npm setup
Publishing uses npm trusted publishing through GitHub Actions OIDC, without a
long-lived NPM_TOKEN. Configure the trusted publisher in the npm settings for
@styfrombrest/mailer with these values:
- Provider: GitHub Actions
- Organization or user:
styfrombrest - Repository:
mailer - Workflow filename:
release.yml - Environment: leave blank
- Allowed action:
npm publish
The workflow already grants id-token: write and uses compatible Node and npm
versions. The trusted publisher must be configured before the first workflow run
can publish.
Local release checks
Use the project's Node version and verify the build and package contents before
pushing to master:
nvm install
nvm use
npm ci
npm run build
env HUSKY=0 npm pack --dry-run
git diff --checkThere is currently no test or lint script, so the build and package dry run are the available local release checks.
