public static MandrillMailAddress ToMandrillAddress(this MailAddressDto dto, MandrillMailAddressType type = MandrillMailAddressType.To) => dto == null ? null : new MandrillMailAddress { Email = dto.Address, Name = dto.DisplayName, Type = type };
public static MailboxAddress ToMailboxAddress(this MailAddressDto dto) { if (dto == null) { return(null); } return(new MailboxAddress(dto.DisplayName, dto.Address)); }
public static EmailAddress ToEmailAddress(this MailAddressDto dto) { if (dto == null) { return(null); } return(new EmailAddress(dto.Address, dto.DisplayName)); }
public TemplatedMailMessageDto(string templateName, MailAddressDto recipient = null) { if (templateName == null) { throw new ArgumentNullException(nameof(templateName)); } if (string.IsNullOrWhiteSpace(templateName)) { throw new ArgumentException("Value cannot be empty or whitespace only string.", nameof(templateName)); } this.TemplateName = templateName; if (recipient != null) { this.To.Add(recipient); } }
public static IMailbox CompleteMailbox(this IMailbox mailbox, MailboxDto mailbox_dto, MailAddressDto mailbox_address_dto, List <MailAddressDto> list_alias_dto, MailServerBase server) { mailbox.Id = mailbox_dto.id; mailbox.Tenant = server.Tenant; mailbox.DateCreated = mailbox_dto.date_created; mailbox.Account.Login = mailbox_dto.address; mailbox.Account.Password = ""; mailbox.Account.TeamlabAccount = new Account(new Guid(mailbox_dto.user_id), "", false); mailbox.Account.ServerInformation.ConnectionString = server.ConnectionString; mailbox.Address.Id = mailbox_address_dto.id; mailbox.Address.Name = mailbox_address_dto.name; mailbox.Address.Tenant = mailbox_address_dto.tenant; mailbox.Address.DateCreated = mailbox_address_dto.date_created; mailbox.Address.Domain.Id = mailbox_address_dto.Domain.id; mailbox.Address.Domain.Name = mailbox_address_dto.Domain.name; mailbox.Address.Domain.DateCreated = mailbox_address_dto.Domain.date_added; foreach (var server_alias in mailbox.Aliases) { var alias = list_alias_dto.Find(d => d.name == server_alias.Name); server_alias.Id = alias.id; server_alias.Name = alias.name; server_alias.Tenant = alias.tenant; server_alias.Domain.Id = alias.Domain.id; server_alias.Domain.Name = alias.Domain.name; server_alias.Domain.DateCreated = alias.Domain.date_added; } mailbox.Server = server; return(mailbox); }