Beispiel #1
0
        private void SendApprovalEmail(Page record)
        {
            Person toPerson = Person.LoadByPersonID((int)record.RequestApprovalForPersonID);

            var email = new ElectronicMail();

            email.ToAddress = toPerson.Email;

            var textBlock = new Beweb.TextBlock("Email: Page Approval Request", "Page Approval Request",
                                                @"Dear [--publisherName--],

[--editorName--] requested approval on a page. Please click [--url--] to review.

Thanks.");

            email.Subject = textBlock.Title;

            var body = textBlock.RawBody;

            body = body.Replace("[--publisherName--]", toPerson.FirstName);
            body = body.Replace("[--editorName--]", UserSession.Person.FirstName);
            body = body.Replace("[--url--]", record.GetAdminFullUrl());

            email.FromAddress = Util.GetSetting("EmailFromAddress", "*****@*****.**");
            email.BodyPlain   = body;
            email.Send(true);
        }
Beispiel #2
0
        public void Unsubscribe(string refID)
        {
            //get member ref
            string url = "/database/contacts/" + refID;

            var collection = new WebHeaderCollection();

            collection.Add("Authorization", string.Format("Engage {0}", APIToken));
            var obj = new {
                ReferenceID = refID,
                Data        = new object[] {
                    new {
                        FieldID = GetFieldID("Opted Out"),
                        Name    = "Opted Out",
                        Value   = "true"
                    },
                    new {
                        FieldID = GetFieldID("Email Permission"),
                        Name    = "Email Permission",
                        Value   = "false"
                    }
                },
                ItemXml    = (string)null,
                Source     = (string)null,
                FormAction = (string)null
            };

            try {
                var response = Http.Request(Http.PUT, "https://api.ubiquity.co.nz" + url, new JsonSerializer().Serialize(obj), collection);
            } catch (Exception e) {
                var email = new ElectronicMail();
                email.Subject = "Engage Error - Unsubscribing member " + refID;
                string body = "";
                body             += @"
	ReferenceID: "     + refID + @"
	Action Taken: Unsubscribing"     + @"
	Errors as follows: "     + e.Message + @"
	Data:
	"     + new JsonSerializer().Serialize(obj);
                email.BodyPlain   = body;
                email.ToAddress   = "*****@*****.**";
                email.FromAddress = SendEMail.EmailFromAddress;
                email.FromName    = SendEMail.EmailFromName;
                email.Send(false);
            }
        }
Beispiel #3
0
        public void Send(ElectronicMail electronicMail)
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://192.168.12.151:1141/");

            client.DefaultRequestHeaders.Accept.Add(
                new MediaTypeWithQualityHeaderValue("application/json"));

            var response = client.PostAsJsonAsync("api/ElectronicMail/Send", electronicMail).Result;

            if (response.IsSuccessStatusCode)
            {
            }
            else
            {
            }
        }
Beispiel #4
0
        public static void Send(this ElectronicMail electronicMail)
        {
            IFElectronicMail iFElectronicMail = new FElectronicMail();

            iFElectronicMail.Send(electronicMail);
        }