I use the adminCreateUser to create an account for my user with a temp password sent by email. Here my lambda code :
const signup: ValidatedEventAPIGatewayProxyEvent<typeof schema> = async (event) => {
const email = event.body.email.toLowerCase();
const UserPoolId: string = process.env.COGNITO_USERPOOL_ID;
const param: CognitoIdentityServiceProvider.Types.AdminCreateUserRequest = {
UserPoolId,
Username: email,
DesiredDeliveryMediums: ['EMAIL'],
UserAttributes: [{Name: 'email', Value: email}],
};
try {
const result = await cognitoClient.adminCreateUser(param).promise();
console.log({User: result.User, response: result.$response});
return accepted();
} catch (error) {
console.error({error});
return internalServerError(error.message);
}
};
Cognito is configured to work with SES. Here is my Cloudformation configuration :
CognitoUserPoolPerfectPostUserPool: {
Type: 'AWS::Cognito::UserPool',
Properties: {
UserPoolName: "perfect-post-user-pool",
UsernameAttributes: ['email'],
AutoVerifiedAttributes: ['email'],
AdminCreateUserConfig: {
AllowAdminCreateUserOnly: true,
},
Schema: [
{
Name: 'email',
AttributeDataType: 'String',
Mutable: true,
Required: true,
},
],
EmailConfiguration: {
EmailSendingAccount: 'DEVELOPER',
From: 'Perfect Post <contact@perfectpost.fr>',
SourceArn: 'arn:aws:ses:eu-west-3:xxx:identity/perfectpost.fr'
},
},
},
My account is out of Sandbox for SES. I have now 1000 users registered to Cognito and 160 of them never received the email with the code and are locked in FORCE_CHANGE_PASSWORD. My users tell me that the email is not in spam either, it is nowhere.
There is no error in Cloudwatch also in SES. My Bounce rate is low and I am not sending more than 14 emails per second, it's flagged as sent: SES dahsboard capture
I have made some spam check with websites like mail-tester.com or zerobounce.net there is no alert with my email content.
I am not seeing what I'm missing out. Or maybe it's normal to have bounce because my domain was registered in January and it's too young. Should I pay for a dedicated ip ?