Advertisement
2bicz

Untitled

Jun 21st, 2022
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Net;
  7. using System.Net.Mail;
  8.  
  9. namespace VoiceAssistant
  10. {
  11.     class Mail
  12.     {
  13.         public void SendMail(string body, string addr)
  14.         {
  15.             StringFromRichTextBox Sfr = new StringFromRichTextBox();
  16.  
  17.             MailMessage mail = new MailMessage();
  18.             SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
  19.  
  20.             mail.From = new MailAddress("rajesh331912@gmail.com");
  21.             mail.To.Add(addr);
  22.             mail.Subject = "Messege from Rajesh";
  23.             mail.Body = body;
  24.  
  25.             SmtpServer.Port = 587;
  26.             SmtpServer.Credentials = new System.Net.NetworkCredential("rajesh331912", "5%A/9Yc+/@j,_jS");
  27.             SmtpServer.EnableSsl = true;
  28.  
  29.             SmtpServer.Send(mail);
  30.  
  31.  
  32.         }
  33.  
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement