Represents a file attachment
Example #1
0
        /// <summary>
        /// Verzend een email naar de ontvanger
        /// </summary>
        /// <returns>een true als er geen foutmelding was</returns>
        public void Send(string fromEmailAddress, string emailAdres, string onderwerp, string templateName, Dictionary<string, object> propertyBag, MessageAttachment[] attachments)
        {
            if (string.IsNullOrEmpty(emailAdres))
            {
                throw new Exception("Geen emailadres opgegeven");
            }
            if (string.IsNullOrEmpty(onderwerp))
            {
                throw new Exception("Geen onderwerp opgegeven");
            }

            Message message = new Message();
            message.Body = emailTemplateParserService.Parse("email", templateName, propertyBag);
            message.To = emailAdres;

            if (!string.IsNullOrEmpty(bccEmailAddress))
            {
                message.Bcc = bccEmailAddress;
            }
            if (!string.IsNullOrEmpty(fromEmailAddress))
            {
                message.From = fromEmailAddress;
            }
            else
            {
                message.From = this.fromEmailAddress;
            }
            message.Subject = onderwerp;
            message.Format = Format.Html;

            if (attachments != null)
            {
                foreach (MessageAttachment attachment in attachments)
                {
                    if (attachment != null)
                    {
                        message.Attachments.Add(attachment);
                    }
                }
            }
            Send(message);
        }
 public void Add(MessageAttachment attachment)
 {
     InnerList.Add(attachment);
 }
		public void Add(MessageAttachment attachment)
		{
			InnerList.Add(attachment);
		}