Email Programming
Email-
It is used to send a message electronically.
Types of email-
1. Simple mailing(Gmail,Yahoo)
Open to all.
2. Domain Based Email(WebMail)
Company uses this kind of mail.
Email programming in dot net-
Steps-
1. Include library-
using System.Net.Mail;
2. Objects are created-
i. smtpClient
ii. MailMessage
3. Format of email-
html
Coding-
//Two parameters - domain name and port number of email.
smtpClient sm = new smtpClient("student-cell.com",25);
// here we have to give the credentials email id and password
sm.Credentials = new System.Net.NetworkCredential("contact@student-cell.com","password");
//this method will deliver your email to network
sm.DeliveryMethod = smtpDeliveryMethod.Network;
// Mail Message object is created passing the email id and the control where recipient id will be
MailMessage mm = new MailMessage("contact@student-cell.com",TextBox1.Text);
mm.Subject = "Hey buddy its me" + TextBox1.Text;
mm.Body = "Your PassCode is 12345..... Don't Share this with anyone";
//email format is html so enabling it
mm.IsBodyHtml = true;
//sending the mail
sm.Send(mm);
Comments
Post a Comment