void SendSystemEmail(VLSystemEmail pendingEmail)
        {
            IEmailProvider provider = GetProvider();

            InfoFormat("TheSystemMailer({0})::SendSystemEmail(), called for EmailId={1} & Subject={2} & ToAddress={3}", this.Name, pendingEmail.EmailId, pendingEmail.Subject, pendingEmail.ToAddress);

            var         subject = pendingEmail.Subject;
            var         body    = pendingEmail.Body;
            MailAddress from    = new MailAddress(pendingEmail.FromAddress, pendingEmail.FromDisplayName, Encoding.UTF8);
            MailAddress to      = new MailAddress(pendingEmail.ToAddress);
            MailAddress replyTo = new MailAddress(pendingEmail.FromAddress);

            bool emailed = provider.SendEmail(from, to, replyTo, subject, Encoding.UTF8, body, Encoding.UTF8, false);

            if (emailed == false)
            {
                DebugFormat("Sending email to {0} (EmailId = {1}, subject = {2})-> FAILED", pendingEmail.ToAddress, pendingEmail.EmailId, pendingEmail.Subject);
                pendingEmail.Status = EmailStatus.Failed;
                pendingEmail.Error  = "provider.SendEmail() returned false!";
                pendingEmail.SendDT = Utility.UtcNow();
                return;
            }

            DebugFormat("Sending email to {0} (EmailId = {1}, subject = {2})-> SUCCESS", pendingEmail.ToAddress, pendingEmail.EmailId, pendingEmail.Subject);
            pendingEmail.Status = EmailStatus.Sent;
            pendingEmail.SendDT = Utility.UtcNow();
        }
Example #2
0
        protected override void ProcessGetRequestWrapped(Valis.Core.VLAccessToken accessToken, HttpContext context)
        {
            var messageId = TryParseInt32(context, "messageId");

            var manager = VLSurveyManager.GetAnInstance(accessToken);
            var message = manager.GetMessageById(messageId);

            if (message == null)
            {
                throw new VLException(SR.GetString(SR.There_is_no_item_with_id, "Message", messageId));
            }

            /*
             * Τώρα στέλνουμε το verification sender email για αυτό το message:
             */
            VLSystemEmail verify_email = manager.SendVerifySenderEmail(message);


            //empty json object
            context.Response.Write("{}");
        }