示例#1
0
        public static async Task <String> EnviarContactoAdmin(Contacto contacto)
        {
            var task = api.UserInfoAsync();


            EmailMessage message = new EmailMessage();

            message.subject = "Se ha realizado un nuevo contacto";
            string body = GetContactoTemplate();

            body         = body.Replace("{{EMAIL}}", contacto.Email);
            body         = body.Replace("{{MENSAJE}}", contacto.Mensaje);
            message.html = body;
            EmailAddress        address    = new EmailAddress("*****@*****.**");
            List <EmailAddress> listaEmail = new List <EmailAddress>();

            listaEmail.Add(address);
            message.to        = listaEmail;
            message.from_name = "ClothIt";

            await task.ContinueWith(data =>
            {
                var userInfo       = data.Result;
                message.from_email = userInfo.username;
            });


            List <EmailResult> resultados = await api.SendMessageAsync(message);

            return("Mensaje Enviado");
        }