Upac.Core.Mail.Message.Send C# (CSharp) Method

Send() public method

public Send ( ) : bool
return bool
        public bool Send()
        {
            if (!string.IsNullOrEmpty(mailMessage.Body))
            {
                throw new Exception("You should not set body directly on MailMessage. Use Message!");
            }

            if (string.IsNullOrEmpty(From))
            {
                if (SendFromNoReplyAddress)
                {
                    // TODO
                    //From = siteSettings.GetSetting("Email/NoReplyEmail");
                }
                else
                {
                    // TODO
                    //From = siteSettings.GetSetting("Email/DefaultFromEmail");
                }
            }

            Diagnostics.Assert.EnsureStringValue(mailMessage.From.Address, "From address not specified");

            string fullBody = GetFullBody();
            if (TemplateVariables.Count > 0)
            {
                fullBody = Utilities.VelocityUtil.Evaluate(fullBody, TemplateVariables);
            }

            mailMessage.Body = fullBody;
            StandardSender sender = new StandardSender();
            bool sendt = sender.Send(mailMessage);
            mailMessage.Dispose();
            return sendt;
        }

Usage Example

Esempio n. 1
0
 public static bool SendMail(string to, string from, string subject, string body, bool isBodyHtml)
 {
     Message message = new Message()
                           {
                               Subject = subject,
                               Body = body,
                               IsBodyHtml = isBodyHtml,
                               From = from,
                               IncludeFooter = false,
                               IncludeHeader = false
                           };
     message.To.Add(to);
     return message.Send();
 }
All Usage Examples Of Upac.Core.Mail.Message::Send