mirror of
https://github.com/bitwarden/server
synced 2025-12-15 07:43:54 +00:00
[PM-21741] Welcome email updates (#6479)
feat(PM-21741): implement MJML welcome email templates with feature flag support - Add MJML templates for individual, family, and organization welcome emails - Track *.hbs artifacts from MJML build - Implement feature flag for gradual rollout of new email templates - Update RegisterUserCommand and HandlebarsMailService to support new templates - Add text versions and sanitization for all welcome emails - Fetch organization data from database for welcome emails - Add comprehensive test coverage for registration flow Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
This commit is contained in:
@@ -424,6 +424,8 @@ public class HandlebarsMailService : IMailService
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
// TODO: DO NOT move to IMailer implementation: PM-27852
|
||||
[Obsolete("Use SendIndividualUserWelcomeEmailAsync instead")]
|
||||
public async Task SendWelcomeEmailAsync(User user)
|
||||
{
|
||||
var message = CreateDefaultMessage("Welcome to Bitwarden!", user.Email);
|
||||
@@ -437,6 +439,50 @@ public class HandlebarsMailService : IMailService
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
// TODO: Move to IMailer implementation: PM-27852
|
||||
public async Task SendIndividualUserWelcomeEmailAsync(User user)
|
||||
{
|
||||
var message = CreateDefaultMessage("Welcome to Bitwarden!", user.Email);
|
||||
var model = new BaseMailModel
|
||||
{
|
||||
WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
|
||||
SiteName = _globalSettings.SiteName
|
||||
};
|
||||
await AddMessageContentAsync(message, "MJML.Auth.Onboarding.welcome-individual-user", model);
|
||||
message.Category = "Welcome";
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
// TODO: Move to IMailer implementation: PM-27852
|
||||
public async Task SendOrganizationUserWelcomeEmailAsync(User user, string organizationName)
|
||||
{
|
||||
var message = CreateDefaultMessage("Welcome to Bitwarden!", user.Email);
|
||||
var model = new OrganizationWelcomeEmailViewModel
|
||||
{
|
||||
OrganizationName = CoreHelpers.SanitizeForEmail(organizationName, false),
|
||||
WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
|
||||
SiteName = _globalSettings.SiteName
|
||||
};
|
||||
await AddMessageContentAsync(message, "MJML.Auth.Onboarding.welcome-org-user", model);
|
||||
message.Category = "Welcome";
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
// TODO: Move to IMailer implementation: PM-27852
|
||||
public async Task SendFreeOrgOrFamilyOrgUserWelcomeEmailAsync(User user, string familyOrganizationName)
|
||||
{
|
||||
var message = CreateDefaultMessage("Welcome to Bitwarden!", user.Email);
|
||||
var model = new OrganizationWelcomeEmailViewModel
|
||||
{
|
||||
OrganizationName = CoreHelpers.SanitizeForEmail(familyOrganizationName, false),
|
||||
WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
|
||||
SiteName = _globalSettings.SiteName
|
||||
};
|
||||
await AddMessageContentAsync(message, "MJML.Auth.Onboarding.welcome-family-user", model);
|
||||
message.Category = "Welcome";
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
public async Task SendTrialInitiationEmailAsync(string userEmail)
|
||||
{
|
||||
var message = CreateDefaultMessage("Welcome to Bitwarden; 3 steps to get started!", userEmail);
|
||||
|
||||
Reference in New Issue
Block a user