import { Mailchain } from '@mailchain/sdk';
const secretRecoveryPhrase = process.env.SECRET_RECOVERY_PHRASE!; // 24 word mnemonicPhrase
const mailchain = Mailchain.fromSecretRecoveryPhrase(secretRecoveryPhrase);
const { data, error } = await mailchain.sendMail({
from: `yoursername@mailchain.com`, // sender address
to: [`0xbb56FbD7A2caC3e4C17936027102344127b7a112@ethereum.mailchain.com`], // list of recipients (blockchain or mailchain addresses)
subject: 'My first message', // subject line
content: {
text: 'Hello Mailchain ????', // plain text body
html: '
Hello Mailchain ????
', // html body
},
});
if (error) {
// handle error
console.warn('Mailchain error', error);
return;
}
// handle success send mail result
console.log(data);