Framework.Core.Utilities.Email.MailTemplate.Send C# (CSharp) Method

Send() public method

Send email.
public Send ( ) : bool
return bool
        public bool Send()
        {
            return Send(SmtpHost, SmtpUser, SmtpPassword);
        }

Same methods

MailTemplate::Send ( String smtpHost, String user, String password ) : bool

Usage Example

        /// <summary>
        /// Sends the form answer email.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="formAnswer">The form answer.</param>
        /// <returns></returns>
        public static bool SendFormAnswerEmail(FormBuilderWidget model, FormWidgetAnswer formAnswer)
        {
            var templatePath = Path.Combine(FormsPlugin.Instance.PluginDirectory + FormsTemplatesDirectory, FormsAnswerTemplate);
            var email = new MailTemplate(templatePath)
                                    {
                                        FromEmail = EmailSettings.FromEmail,
                                        Subject = HttpUtility.HtmlEncode(model.Title),
                                        ToEmail = model.RecipientEmail
                                    };

            FillFormAnswers(email, model, formAnswer);
            return email.Send();
        }