/// <summary> /// Include an attachment to the email /// </summary> /// <param name="attachment"></param> public IEmailRepository Attach(model.Attachment attachment) { if (attachment != null) { Message.AddAttachment(attachment.Name, Convert.ToBase64String(attachment.Content), type: attachment.ContentType); } return(this); }
/// <summary> /// Include an attachment to the email /// </summary> /// <param name="attachment"></param> public IEmailRepository Attach(model.Attachment attachment) { if (attachment != null) { var _attachment = new Attachment(new MemoryStream(attachment.Content), attachment.Name, attachment.ContentType); if (!Message.Attachments.Contains(_attachment)) { Message.Attachments.Add(_attachment); } } return(this); }