Пример #1
0
    public static Boolean SendMessageEmail(MailAddressCollection destinyEmails, string sujeto, string body)
    {
        Boolean     bTodoOk = true;
        MailMessage msg     = new MailMessage();
        SmtpClient  client  = EmailUtils.GetSmtpClient();

        //1.-Destino del mensaje
        msg.From = new MailAddress(smtp_user);
        foreach (MailAddress email in destinyEmails)
        {
            msg.To.Add(email);
        }

        //2.-Sujeto del mensaje
        msg.Subject = sujeto;

        //2.-Cuerpo del mensaje
        msg.Body = body;

        try
        {
            client.Send(msg);
        }
        catch (Exception excp)
        {
            bTodoOk = false;
        }
        finally
        {
            msg.Dispose();
            client.Dispose();
        }
        return(bTodoOk);
    }