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.