Problem sending mail from within C#

  • Thread starter Thread starter Moksi-2
  • Start date Start date
M

Moksi-2

Guest
I have constructed a snippet that sends mail from within C#.

In My script, there are two receivers. One receiver is myself while

the second receiver is 2ndReceiver@outlook.com. When I run the script, I get the mail

to my self but the second receiver fails to get his mail. What is the problem ????

private void Send_Mail()
{
try
{
MailMessage mail = new MailMessage();
SmtpClient client = new SmtpClient();
client.Port = 587;
client.Host = Nsmtp;

mail.From = new MailAddress(Mailsender);
mail.To.Add(Mailreceiver);
mail.Subject = MailTitle;
mail.Body = Mailbody;

//SmtpServer.Port = 25;
//textBox1.Text = Nsmtp + " " + Mailreceiver;

client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential(Mailsender, Npass);
client.EnableSsl = true;
client.Send(mail);
// MessageBox.Show("mail Send");
}
catch (Exception ex){}
}

Continue reading...
 
Back
Top