Exemplo n.º 1
0
        public string SendMail()
        {
            var service = new SendGridEmailService(
                "*****@*****.**",
                "test email",
                "*****@*****.**",
                Body,
                true,
                true
                );

            service.Send();

            return("");
        }
Exemplo n.º 2
0
        public void SendIntroMail(int companyId, string subject, string body, string email)
        {
            var header = new Attachment
            {
                Content     = Convert.ToBase64String(System.IO.File.ReadAllBytes(HttpContext.Current.Server.MapPath("/img/bg-email.jpg"))),
                ContentId   = "header",
                Filename    = "header",
                Disposition = "inline",
                Type        = "image/jpg",
            };
            var banner = new Attachment
            {
                Content     = Convert.ToBase64String(System.IO.File.ReadAllBytes(HttpContext.Current.Server.MapPath("/img/logo.png"))),
                ContentId   = "banner",
                Filename    = "banner",
                Disposition = "inline",
                Type        = "image/png",
            };

            var logo = new Attachment
            {
                Content     = Convert.ToBase64String(System.IO.File.ReadAllBytes(HttpContext.Current.Server.MapPath("/img/dbo.png"))),
                ContentId   = "logo",
                Filename    = "logo",
                Disposition = "inline",
                Type        = "image/png",
            };

            var registrationRepository = new RegistrationRepository();

            body = body.Replace("http://discoverbusinessopportunities.com",
                                "http://discoverbusinessopportunities.com/home/register?token=" +
                                registrationRepository.GetRegistrationCode(companyId));


            var service = new SendGridEmailService(
                email,
                subject,
                email,
                body,
                true,
                true,
                banner,
                logo
                );

            service.Send();
        }