public bool ExecuteEmail(EbApi Api, RabbitMqProducer MessageProducer3) { bool status; try { EbEmailTemplate emailTemplate = Api.GetEbObject <EbEmailTemplate>(this.Reference, Api.Redis, Api.ObjectsDB); List <Param> InputParams = EbApiHelper.GetEmailParams(emailTemplate, Api.Redis, Api.ObjectsDB); Api.FillParams(InputParams); MessageProducer3.Publish(new EmailAttachmentRequest() { ObjId = Convert.ToInt32(this.Reference.Split(CharConstants.DASH)[3]), Params = InputParams, UserId = Api.UserObject.UserId, UserAuthId = Api.UserObject.AuthId, SolnId = Api.SolutionId, RefId = this.Reference }); status = true; string msg = $"The mail has been sent successfully to {emailTemplate.To} with subject {emailTemplate.Subject} and cc {emailTemplate.Cc}"; Api.ApiResponse.Message.Description = msg; } catch (Exception ex) { throw new ApiException("[ExecuteEmail], " + ex.Message); } return(status); }
private void TimerElapsed(object sender, ElapsedEventArgs e) { Parallel.ForEach(Enumerable.Range(0, ConfigHelper.ProducerBatchCount), (index) => { RabbitMqProducer.Publish( ConfigHelper.QueueId, new PressureTestContent() { Content = $"{DateTime.Now.ToString("yyyyMMddhhmmssfff")}-{index}", CreateDateTime = DateTime.Now }); }); }
public void SendWelcomeMail(RabbitMqProducer MessageProducer3, User user, Eb_Solution solution) { string Html = this.MailHtml .Replace("{SolutionName}", solution.SolutionName) .Replace("{eSolutionId}", solution.ExtSolutionID) .Replace("{iSolutionId}", solution.SolutionID) .Replace("{UserName}", this.UserCredentials.Name) .Replace("{Email}", this.UserCredentials.Email) .Replace("{Password}", this.UserCredentials.Pwd) .Replace("{SolutionAdmin}", string.IsNullOrEmpty(user.FullName) ? $"{solution.SolutionName} Team" : user.FullName); //this.EbConnectionFactory.EmailConnection.Send("*****@*****.**", "test", "Hiii", null, null, null, ""); MessageProducer3.Publish(new EmailServicesRequest() { To = this.UserCredentials.Email, Message = Html, Subject = $"Welcome to {solution.SolutionName} Solution", UserId = user.UserId, UserAuthId = user.AuthId, SolnId = solution.SolutionID }); }