Ejemplo n.º 1
0
    public void ShouldAddTheRecipientToTheRecipientsList() {
      EmailAgent agent = new EmailAgent("*****@*****.**", "mailname");
      EmailMessage message = new EmailMessage("mailmessage");

      Assert.AreEqual(0, message.Recipients.Length);
      message.AddRecipient(agent);
      Assert.AreEqual(1, message.Recipients.Length);
      Assert.AreEqual("mailname", message.Recipients[0].Name);
    }
Ejemplo n.º 2
0
        public void SendText() {
            EmailMessage message = new EmailMessage("somemessage");
            message.Sender = new EmailAgent("*****@*****.**", "somename");
            message.Subject = "somesubject";
            message.IsBodyHtml = false;
            message.Message = "sometext";
            message.AddRecipient(new EmailAgent("*****@*****.**", "Neylor Ohmaly"));

            Dictionary<string, string> options = new Dictionary<string, string>();
            options["smtp-host"] = "smtp.acao.net.br";
            options["smtp-port"] = "25";
            SmtpMessenger messenger = new SmtpMessenger("somename", options);
            ResponseMessage response = messenger.Send(message);
            Assert.AreEqual(ResponseMessageType.ProcessedMessage, response.Type);
        }
Ejemplo n.º 3
0
        static void SendHtml() {
            EmailMessage message = new EmailMessage("somemessage");
            message.Sender = new EmailAgent("*****@*****.**", "Comunicacao Acao");
            message.Subject = "Pesquisa Perfil";
            message.IsBodyHtml = true;
            message.Message =
@"<html>
	<head>
		<title>Pesquisa Perfil Acao</title>
	</head>
	<body>
		<a href=""$link$"">
			<img alt=""Pesquisa Perfil Acao"" src=""http://192.168.203.8:8080/images/pesquisa_adm.jpg""/>
		</a>
	</body>
</html>";
            message.AddRecipient(new EmailAgent("*****@*****.**", "Comunicacao"));

            Dictionary<string, string> options = new Dictionary<string, string>();
            options["smtp-host"] = "smtp.acao.net.br";
            options["smtp-port"] = "25";
            SmtpMessenger messenger = new SmtpMessenger("somename", options);
            ResponseMessage response = messenger.Send(message);
        }