Sitecore SMTP testing

Many time developer need to do quick test about SMTP is working or not. I think most of the time developer add some code in project and deploy for testing.

So for testing instead of compile and deploy; we can test quickly in less efforts.

Create .aspx file using any simple editor and put file within sitecore website folder where you can access from browser. I normally put in layout folder and delete after testing.

Code is

<%@ Page Language="C#"  %>
<%@ Import Namespace="System.Net.Mail" %>
<%@ Import Namespace="Sitecore" %>

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
    <title>SMTP Testing</title>
    <form id="form1" runat="server">
        <asp:TextBox runat="server" ID="txtEmailTo" Text=""/>
        <asp:Button runat="server" Text="Send test email" ID="btnSendEmail" OnClick="btnSendEmail_OnClick"/>

<script language="c#" runat="server">
    protected void btnSendEmail_OnClick(object sender, EventArgs e)
        var emailMessage = new MailMessage("", txtEmailTo.Text, "SMTP Test", "Testing email from TestSMTP.aspx");

        Response.Write("Email sent!!");

Leave a Reply