@fabbijsc/medusa-plugin-aws-ses
v1.1.0
Published
Aws SES plugin for Medusa
Downloads
19
Maintainers
Readme
AWS SES (Fabbi JSC)
Prerequisites
How to Install
1. Run the following command in the directory of the Medusa backend:
npm i @fabbijsc/medusa-plugin-aws-ses
2. Set the following environment variables in .env
:
AWS_ACCESS_KEY=
AWS_SECRET_KEY=
AWS_REGION=
SES_SENDER=
3. In medusa-config.js
add the following at the end of the plugins
array:
const plugins = [
// ...
{
resolve: `@fabbijsc/medusa-plugin-aws-ses`,
options: {
aws_credential: {
access_key: process.env.AWS_ACCESS_KEY,
secret_key: process.env.AWS_SECRET_KEY,
region: process.env.AWS_REGION,
sender: process.env.SES_SENDER,
},
}
},
]
Use the Plugin
import { TransactionBaseService } from '@medusajs/medusa';
import { ISesOption, SesService } from '@fabbijsc/medusa-plugin-aws-ses/dist';
import { EMailType } from '@enums/Mail.enum';
type ConstructorParams = {
sesService: SesService;
};
interface IOption extends ISesOption {
type: EMailType;
}
class MailService extends TransactionBaseService {
sesService: SesService;
constructor(private readonly container: ConstructorParams) {
super(container);
this.sesService = container.sesService;
}
async send(option: IOption): Promise<void> {
await this.sesService.send(option, false);
}
}
export default MailService;