CODE:
using System.Net;
using System.Net.Mail;
string to, from, mess, pass;
MailMessage message = new MailMessage();
to = (txtPhone.Text).ToString();
from = (txtGmail.Text).ToString();
mess = (txtMessage.Text).ToString();
pass = (txtPass.Text).ToString();
message.To.Add(to);
message.From = new MailAddress(from);
message.Body = mess;
SmtpClient smtp = new SmtpClient("smtp.gmail.com");
smtp.EnableSsl = true;
smtp.Port = 587;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Credentials = new NetworkCredential(from, pass);
try
{
smtp.Send(message);
MessageBox.Show("send successfully", "message", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
for all procedure you must watch video:
using System.Net;
using System.Net.Mail;
string to, from, mess, pass;
MailMessage message = new MailMessage();
to = (txtPhone.Text).ToString();
from = (txtGmail.Text).ToString();
mess = (txtMessage.Text).ToString();
pass = (txtPass.Text).ToString();
message.To.Add(to);
message.From = new MailAddress(from);
message.Body = mess;
SmtpClient smtp = new SmtpClient("smtp.gmail.com");
smtp.EnableSsl = true;
smtp.Port = 587;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Credentials = new NetworkCredential(from, pass);
try
{
smtp.Send(message);
MessageBox.Show("send successfully", "message", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
for all procedure you must watch video:
No comments:
Post a Comment