Using Microsoft Exchange sever to send e-mails. RRS feed

  • Question

  • Hi,


    I am trying to use Microsoft Exchange sever to send email using System.Net.Mail.


    The email works if the email address is something@ps.net (ie domain is ps.net) the  but donot work in case of somename@yahoo.com or somename@rediffmail.com.


    Here is the code I am using.


    MailAddress toAddress = new MailAddress("girish008_in@yahoo.com");

    MailAddress fromAddress = new MailAddress("xxxxx@ps.net");

    MailAddressCollection addresses = new MailAddressCollection();


    MailMessage msg = new MailMessage(fromAddress, toAddress);

    msg.Subject = "Subject";

    msg.Body = "Hi, Auto generated mail test";

    SmtpClient mail = new SmtpClient("pscbanpexch01");

    mail.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

    msg.Priority = MailPriority.High;



    I am getting a exception "Mailbox not found. The server response was: 5.7.1 Unable to relay for girish008_in@yahoo.com "



    Am i missing something.


    With regards,

    Girish R. Pawar.

    Friday, May 25, 2007 1:13 PM