You can use the following components to send mail from your Web site:

System.Net.Mail:

For detailed description of System.Net.Mail namespace please use following links:

The System.Net.Mail namespace supports SMTP authentication, so you can use either scriptmail.intermedia.net mail server or your POP mail server ''mail.domain.name" to send mail from scripts. The below examples are written in C# and VBScript, they will work on all our Windows 2008 servers.

C#

<%@ Import Namespace="System.Net.Mail"%>
<script language="C#" Debug="true" runat="server">
    void Page_Load()
    {
            try
            {
            MailMessage oMsg = new MailMessage();
            oMsg.From = new MailAddress("mailbox@yourdomain.com");
            oMsg.To.Add("recipient@theirdomain.com");
            oMsg.Subject = "This is an email";
            oMsg.Body = "<HTML><BODY><B>Hello World!</B></BODY></HTML>";
            SmtpClient smtp = new SmtpClient("scriptmail.intermedia.net");
            smtp.Send(oMsg);
            oMsg = null;
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
            }
        }
</script>


VBScript

<%@ Import Namespace="System.Net.Mail"%>
<script language="VBScript" Debug="true" runat="server">
    sub Page_Load()
        Dim oMsg As New MailMessage()
        oMsg.From = New MailAddress("mailbox@yourdomain.com")
        oMsg.To.Add("recipient@theirdomain.com")
        oMsg.Subject = "This is an email"
        oMsg.Body = "<HTML><BODY><B>Hello World!</B></BODY></HTML>"
        Dim smtp As New SmtpClient("scriptmail.intermedia.net")
        smtp.Send(oMsg)
        oMsg = Nothing
    end sub
</script>



CDOSYS

To send mail using classic ASP, you can also use CDOSYS library. For more information about the library, please check here. Please note that this is a pretty old library and it is recommended to use System.Net.Mail instead.

You need to use scriptmail.intermedia.net mail server to send mail from scripts. The below example is written in VBScript.

<%
Set myMail=CreateObject("CDO.Message")
    myMail.Subject="This is an email"
    myMail.From="
mailbox@yourdomain.com"
    myMail.To="recipient@theirdomain.com"
    myMail.TextBody="Hello world!"
    myMail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
    'SMTP server
    myMail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="scriptmail.intermedia.net"
    'SMTP port
    myMail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
    myMail.Configuration.Fields.Update
    myMail.Send
    set myMail=nothing
%>