private Mail CreateNewEntityAccountActivationEmail(EntityAccountType type, User user, string token) { return(new Mail { From = Constants.FROM_EMAIL_ADDRESS, To = user.Username, Subject = Constants.ACCOUNT_ACTIVATION_SUBJECT, Body = "Welcome to Fabrit heroes! \nYou are a " + type.ToString() + "\nYour new Password is: " + user.Password + "\n" + Constants.ACCOUNT_ACTIVATION_BODY + Constants.ACCOUNT_ACTIVATION_LINK + token }); }
public async Task SendNewEntityActivation(EntityAccountType type, User user, string token) { try { var emailContent = CreateNewEntityAccountActivationEmail(type, user, token); var mail = ConfigureMailMessage(emailContent); var smtpServer = ConfigureStmpClient(); await smtpServer.SendMailAsync(mail); } catch (Exception ex) { throw new SendEmailException(ex.Message, ex); } }