Using windows live as SMTP relay server

Today I started writing a program to notify me when IP assigned to my router by my broadband provider changes. I wanted this program to check IP address of the router every few minutes and send me email if it detects that IP is changed. For sending email, I used System.Net.Mail.SmtpClient which requires a smtp host. Instead of running a smtp server on my machine, I started looking for free smtp relay servers available on the internet. I was surprised to find out that there are plenty of them available. In fact most of the popular email service providers like windows live, yahoo, gmail offer smtp relay services. You can read more about smtp relay servers and get a list of freely available smtp relay servers here.

Below is the code I used to send email notification using windows live smtp relay. If you want to use gmail, you can use "" as the smtphost with gmail credentials.

bool SendEmailNotification(string newIpAddress)
    bool success = false;

    // Send email using live account
    SmtpClient mailClient = new SmtpClient("", 587);
    mailClient.UseDefaultCredentials = false;
    mailClient.EnableSsl = true;

    MailMessage message = new MailMessage("", destination@domain);
    message.Subject = "Require immediate action – IP address change";
    message.Body = "New IP address is " + newIpAddress;
    message.Priority = MailPriority.High;

    NetworkCredential credentials =
new NetworkCredential("", "YourPassword", "");
    mailClient.Credentials = credentials;

        success = true;
    catch (Exception ex)

    return success;


I am still making some changes to my IpChangeMailer program. I will make it available for download once it is complete.


3 thoughts on “Using windows live as SMTP relay server

  1. Hi,
    I dont understand. Basically the IP that you get from your provider stays unless you do not disconnect or switch off your router, right? 
    So, I am not sure if the ISP can change the IP of a client in this way, even if it does, don't you get disconnected ?
    Please clarify me if I am wrong. 
    And by the way I got your site address from the contacts mentioned in the `Making PHP faster on IIS` webcast.

  2. Hi,
    I'm trying to send a email with this in C# but it does not work.
    Anybody can tell me what is wrong?
    (it is only a test)
                    MailMessage mailMessage = new MailMessage("", "");
                    mailMessage.Subject = "Your BabyfootClub username and password.";
                    mailMessage.Body = "Your username is: " + sUsername + "\r\n";
                    mailMessage.Body += "Your password is: " + sPasswrod + "\r\n";

                    SmtpClient smtpClient = new SmtpClient("", 25); // the port used by is 25 not 587
                    smtpClient.EnableSsl = true;
                    smtpClient.UseDefaultCredentials = false;
                    smtpClient.Credentials = new System.Net.NetworkCredential("", "mypassword", "");
                    smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;

Leave a Reply

Your email address will not be published. Required fields are marked *