Guest User

Untitled

a guest
Aug 15th, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. using System.Net.Mail;
  2. using Arquitetura.SOLID.DIP.Solucao.Interfaces;
  3.  
  4. namespace Arquitetura.SOLID.DIP.Solucao
  5. {
  6. public class EmailServices : IEmailServices
  7. {
  8. public bool IsValid(string email)
  9. {
  10. return email.Contains("@");
  11. }
  12.  
  13. public void Enviar(string de, string para, string assunto, string mensagem)
  14. {
  15. var mail = new MailMessage(de, para);
  16. var client = new SmtpClient
  17. {
  18. Port = 25,
  19. DeliveryMethod = SmtpDeliveryMethod.Network,
  20. UseDefaultCredentials = false,
  21. Host = "smtp.google.com"
  22. };
  23.  
  24. mail.Subject = assunto;
  25. mail.Body = mensagem;
  26. client.Send(mail);
  27. }
  28. }
  29. }
Add Comment
Please, Sign In to add comment