0
각도 및 SendGrid를 사용하여 전자 메일을 보내려고합니다. NPM 패키지를 올바르게 설치했지만 코드를 구현하는 데 문제가 있습니다. 나는 API 키를 생성 타이프 스크립트는각도 및 노드로 SendGrid 사용 시도
echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
echo "sendgrid.env" >> .gitignore
source ./sendgrid.env
으로 디렉토리에 저장 :
sgemail(){
const sgMail = require('@sendgrid/mail'); //ERROR: Cannot find name 'require'.
sgMail.setApiKey(process.env.SENDGRID_API_KEY); //ERROR: Cannot find name 'process'.
const msg = {
to: '[email protected]',
from: '[email protected]',
subject: 'Sending with SendGrid is Fun',
text: 'and easy to do anywhere, even with Node.js',
html: '<strong>and easy to do anywhere, even with Node.js</strong>',
};
console.log(msg);
sgMail.send(msg);
}
내가 버튼 클릭에 발사하고있다.
Sendgrid는 import { Vibration } from '@ionic-native/vibration';
을 사용하여 Ionic의 진동 패키지를 사용하는 것과 같은 패키지 가져 오기에 대한 정보가 없습니다.