background img

The New Stuff

Asp. Nette Mail Gönderme c# Mail Gönderme



public static void mailGonder(string kimemail, string kimeadi, string mailkonu, string mailicerik,
string gonderenmail, string gonderensifre, bool ssl = false, string host = "")
        {
normalde direk gelen parametrelerlede yapabilirsiniz tabi ama karıştırmayın diye böyle yaptım
            try
            {
                string strKime = kimemail;
                string strKimden = gonderenmail;
                string strMailSunucu = host; //mail.domain.com
                string strKonu = mailkonu;
                string strMailIcerik = mailicerik;
                string strKullaniciAdi = gonderenmail;
                string strParola = gonderensifre;
                MailMessage mesaj = new MailMessage(strKimden, strKime, strKonu, strMailIcerik);
                mesaj.IsBodyHtml = true;
                SmtpClient emailClient = new SmtpClient(strMailSunucu);
                emailClient.Port = 587;
           
                System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential(strKullaniciAdi, strParola);
                emailClient.UseDefaultCredentials = false;
//google gibi güvenlik sertifikası olan sitelerde burayı true yapcaksınız
//hostuda
//smtp.gmail.com olcak
                emailClient.Credentials = SMTPUserInfo;
                emailClient.Send(mesaj);
            }
            catch {
}
        }
Kolay Gelsin
x

Asp.nette dosya yüklerken maksimum istek aşma hatası Maksimum request length exceeded





Aşağıdaki kodu system web tagları arasına yapıştırdığınızda sorununuz düzelecektir

  <httpRuntime targetFramework="4.5"  executionTimeout="110" maxRequestLength="52428800"/>
target freamwok sizin projeyi yaptığınız freamworke göre düzenleyin 4.0 sa 4.0 girin sonra hata alırsınız
50 MB bir Dosyayı hata vermeden yükler

  <system.web>
 
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5"  executionTimeout="110" maxRequestLength="52428800"/>
    <customErrors mode="Off"/>
  </system.web>



Popular Posts