Best Cerberus-source code snippet using org.cerberus.service.notifications.email.impl.EmailService.sendHtmlMail
Source:NotificationService.java
...63 LOG.warn("Exception generating email for account creation.", ex);64 return new MessageEvent(MessageEventEnum.GENERIC_ERROR).resolveDescription("REASON", ex.toString());65 }66 try {67 emailService.sendHtmlMail(email);68 } catch (Exception ex) {69 LOG.warn("Exception sending email for account creation.", ex);70 return new MessageEvent(MessageEventEnum.GENERIC_ERROR).resolveDescription("REASON", ex.toString());71 }72 return new MessageEvent(MessageEventEnum.GENERIC_OK);73 }74 @Override75 public MessageEvent generateAndSendForgotPasswordEmail(User user) {76 Email email = null;77 try {78 email = emailGenerationService.generateForgotPasswordEmail(user);79 } catch (Exception ex) {80 LOG.warn("Exception generating email for forgot password.", ex);81 return new MessageEvent(MessageEventEnum.GENERIC_ERROR).resolveDescription("REASON", ex.toString());82 }83 try {84 emailService.sendHtmlMail(email);85 } catch (Exception ex) {86 LOG.warn("Exception sending email for forgot password.", ex);87 return new MessageEvent(MessageEventEnum.GENERIC_ERROR).resolveDescription("REASON", ex.toString());88 }89 return new MessageEvent(MessageEventEnum.GENERIC_OK);90 }91 @Override92 public MessageEvent generateAndSendRevisionChangeEmail(String system, String country, String env, String build, String revision) {93 Email email = null;94 try {95 email = emailGenerationService.generateRevisionChangeEmail(system, country, env, build, revision);96 } catch (Exception ex) {97 LOG.warn("Exception generating email for revision change.", ex);98 return new MessageEvent(MessageEventEnum.GENERIC_ERROR).resolveDescription("REASON", ex.toString());99 }100 try {101 emailService.sendHtmlMail(email);102 } catch (Exception ex) {103 LOG.warn("Exception sending email for revision change.", ex);104 return new MessageEvent(MessageEventEnum.GENERIC_ERROR).resolveDescription("REASON", ex.toString());105 }106 return new MessageEvent(MessageEventEnum.GENERIC_OK);107 }108 @Override109 public MessageEvent generateAndSendDisableEnvEmail(String system, String country, String env) {110 Email email = null;111 try {112 email = emailGenerationService.generateDisableEnvEmail(system, country, env);113 } catch (Exception ex) {114 LOG.warn("Exception generating email for disabling environment.", ex);115 return new MessageEvent(MessageEventEnum.GENERIC_ERROR).resolveDescription("REASON", ex.toString());116 }117 try {118 emailService.sendHtmlMail(email);119 } catch (Exception ex) {120 LOG.warn("Exception sending email for disabling environment.", ex);121 return new MessageEvent(MessageEventEnum.GENERIC_ERROR).resolveDescription("REASON", ex.toString());122 }123 return new MessageEvent(MessageEventEnum.GENERIC_OK);124 }125 @Override126 public MessageEvent generateAndSendNewChainEmail(String system, String country, String env, String chain) {127 Email email = null;128 try {129 email = emailGenerationService.generateNewChainEmail(system, country, env, chain);130 } catch (Exception ex) {131 LOG.warn("Exception generating email for new chain.", ex);132 return new MessageEvent(MessageEventEnum.GENERIC_ERROR).resolveDescription("REASON", ex.toString());133 }134 try {135 emailService.sendHtmlMail(email);136 } catch (Exception ex) {137 LOG.warn("Exception sending email for new chain.", ex);138 return new MessageEvent(MessageEventEnum.GENERIC_ERROR).resolveDescription("REASON", ex.toString());139 }140 return new MessageEvent(MessageEventEnum.GENERIC_OK);141 }142}...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!