<<İNDİR>>
Dll e çevirip projenize referans etmeniz daha iyi olacaktır.Enable Ssl özelliğini false yaparak heryerde kullanabilirsiniz.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;
namespace MailG
{
public class Mailgonder
{
public static bool Gonder(string konu, string icerik, string gonderen, string alici, string mailkullaniciadi, string mailsifre, int port, string smtpadresi)
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress(gonderen);
mail.To.Add(alici);
mail.Subject = konu;
mail.Body = icerik;
SmtpClient smtp = new SmtpClient(smtpadresi, port);
smtp.EnableSsl = true;
smtp.Credentials = new System.Net.NetworkCredential(mailkullaniciadi, mailsifre);
try
{
smtp.Send(mail);
}
catch (SmtpException ex)
{
// Console.WriteLine(ex.Message);
}
return true;
}
}
}
Hiç yorum yok:
Yorum Gönder