Napisałem kilka linijek programu który wysyła E-maile. Wczoraj wysyłał bez problemu. Dziś uruchomiłem, i nic nie wysyła? Co się stać mogło?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Mail;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
try
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress("email nadawcy");
mail.Subject = ("hjbtncbrfmbvm");
mail.Body = ("gt4jhbngvjhjtrnvkjtr,jnv kjr,hdnv kjr,bmdvn");
mail.To.Add("emial odbiorcy");
SmtpClient client = new SmtpClient();
client.Credentials = new NetworkCredential("email nadawcy", "hasło");
client.Host = ("smtp.wp.pl");
client.Port = 587;
client.EnableSsl = true;
}
catch
{
MessageBox.Show(this, "Error Mail");
}
}
}
}
Blok Try catch nie wyświetla komunikatu o błędzie.