예제 #1
0
        /// <inheritdoc/>
        public void SendVerificationToken(TokenInfoDto verificationTokenInfo)
        {
            string       name                = verificationTokenInfo.Name;
            string       emailAddress        = verificationTokenInfo.EmailAddress;
            string       verificationToken   = verificationTokenInfo.Token;
            string       subjectOfTheMessage = verificationTokenInfo.Subject;
            string       bodyOfTheMessage    = verificationTokenInfo.Body;
            MailTemplate mt = new MailTemplate();

            mt.SetReceiver(name, emailAddress);
            mt.SetMessage(subjectOfTheMessage, bodyOfTheMessage + ": " + verificationToken);
            try
            {
                mt.Send();
            }
            catch (SocketException socketException)
            {
                _logger.Fatal("MailingService.cs: An error related to the socket occured while " +
                              "trying to send the email. Check the credentials for " +
                              "sending the email. Method Send, line 40", socketException);
            }
            catch (ProtocolException protocolException)
            {
                _logger.Fatal("MailingService.cs: An error related with the protocol occured while " +
                              "trying to send the email. Check that you are using a valid " +
                              "protocol for sending the emails.", protocolException);
            }
        }
예제 #2
0
        /// <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());
        }
예제 #3
0
        private void SendEmail()
        {
            MailTemplate mt = new MailTemplate();

            mt.SetReceiver(TextBoxName.Text + " " + TextBoxLastName.Text, TextBoxEMail.Text);
            mt.SetMessage("Contraseña de SCPP", "Profesor con el numero de trabajador: " + TextBoxWorkerNumber.Text + ", tu contraseña para el SCPP es: " + password);
            try
            {
                mt.Send();
            }
            catch (Exception)
            {
            }
        }
예제 #4
0
        private void SendEmail()
        {
            MailTemplate mt = new MailTemplate();

            mt.SetReceiver(TextBoxNombre.Text + " " + TextBoxApellidoPaterno.Text, TextBoxCorreo.Text);
            mt.SetMessage("Contraseña de de SCPP", "Estudiante con matricula " + TextBoxMatricula.Text + ", tu contraseña para el SCPP es: " + TextBoxContraseña.Password);
            try
            {
                mt.Send();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }