C Sharp Mail Sending Code

In this article, we will explain how to make a mail sending module with C#. First, let’s take a look at which classes we will use. For this web application we will include the Net class in our project.
using System.Net;
using System.Net.Mail;
protected void class_Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string posta_konu = "Konuyu buraya yazınız";
string posta_metin= "Eposta metnini buraya yazınız";
SmtpClient postaci = new SmtpClient("mail.omersahin.com.tr", 25); //Giden sunucusu portu:25
postaci.EnableSsl = false; //SSL kullanıyorsanız True yapınız.
NetworkCredential cred = new NetworkCredential("kullanici_adi", "poarola");
postaci.Credentials = cred;
postaci.Send("gonderen_eposta_adresi", "alici_eposta_adresi", posta_konu, posta_metin);
Response.Write("Eposta Gönderildi");
}
}
C#After adapting the codes according to the settings of your own email account, you can send emails with this application.
MAKE A COMMENT
COMMENTS - 0 COMMENTS