pixel
loading...

Website Mail Configuration

Back To Online Support

In order to send mail from web sites hosted on our servers there are rules that you need to follow.

These rules are as follows:

  1. The server must be smtpinternal.isat.co.za
  2. The server port must be 587 (default)
  3. The sender (From) must be ws4@isat.co.za
  4. The recipient will most probably be the webmaster of the site.
  5. The ReplyTo must be the person who filled in the form.

We have a mail component that hides most of this complexity from you (See iSAT Mail Object at bottom of page).
This component cannot be used in C#.

It has the following properties and methods:

Properties:

  • FromName - Sender's friendly name, e.g. Joe Public
  • ReplyTo - Sender's reply to address
  • ToAddress - Recipient email addresses
  • ToCC - Carbon Copy email addresses
  • ToBCC - Blind Carbon Copy email addresses
  • Subject - Subject of email
  • Body - Body of the email
  • Error - Description of any errors that occurred
  • HTML - True if body is in HTML format

Methods:

  • Send - Returns true if sent ok. If false check Error

You need to set up a page with a form that collects and posts the information to an ASP page. Here is Order.htm:

<html>
<head>
<title>
Order</title>
</head>
<body>
<form method=
"POST" action="Send.asp">
<table border=
"1" width="100%">
<tr>
<td width=
"14%">Name</td>
<td width=
"86%"><input type="text" name="Name" size="40"></td>
</tr>
<tr>
<td width=
"14%">Email</td>
<td width=
"86%"><input type="text" name="Email" size="40"></td>
</tr>
<tr>
<td width=
"14%">Description</td>
<td width=
"86%"><input type="text" name="Description" size="40"></td>
</tr>
</table>
<p><input type=
"submit" value="Submit" name="B1"></p>
</form>
&nbsp;
</body>
</html>

Here is Send.asp that sends mail based on the above form:

<html>
<head>
<title>
Send</title>
</head>
<body>
<%
     Set SMTP = Server.CreateObject("iSATMail.SMTP")

     SMTP.FromName = Request("Name")
     SMTP.ToAddress = "myaddress@isat.co.za"
     SMTP.ReplyTo = Request("Email")
     SMTP.Subject = "Request from web by " & Request("Name") 
     SMTP.Body = _
          "Name: " & Request("Name") & Chr(13) & Chr(10) & _
          "Email: " & Request("EMail") & Chr(13) & Chr(10) & _
          "Description: " & Request("Description")

     if not SMTP.Send then
          Response.Write("<p>Error: " & SMTP.Error & "</p>")
     else
          Response.Write("<p>Order sent.</p>")
     end if

     Set SMTP = Nothing
%>
</body>
</html>

For c# you can use the built-in MailMessage object. Here is an example:

In the .aspx file:

<form id="form1" runat="server">
<div>
   First Name:<br />
   <asp:TextBox ID="fnameTxb" runat="server" /><br />
   <br />
   surname:<br />
   <asp:TextBox ID="surnameTxb" runat="server" /><br />
   <br />
   Email:<br />
thaks    <asp:TextBox ID="emailTxb" runat="server" /><br />
   <asp:Button ID="Button1" runat="server" Text="Submit" onclick="Button1_Click" />
</div>
</form>

In the aspx.cs file: (Note: Make sure to implement "using System.Net.Mail;")

protected void Button1_Click( object sender, EventArgs e)
{
    MailMessage MailMsg = new MailMessage();
    try
    {
        // From address MUST be ws4@isat.co.za
        MailMsg.From = new MailAddress("ws4@isat.co.za");
        MailMsg.To.Add(new MailAddress("myaddress@isat.co.za"));
        MailMsg.ReplyTo = new MailAddress(emailTxb.Text);
        MailMsg.Subject = "Example of C# MailMessage object"
        MailMsg.IsBodyHtml = true;

        MailMsg.Body = "<b>Name: </b>" + fnameTxb.Text + "<br>" +
             "<b>Surname: </b>" + surnameTxb.Text + "<br>" +
             "<b>Email: </b>" + emailTxb.Text + "<br>" +
    }
    finally
    {
        SmtpClient client = new SmtpClient("smtpinternal.isat.co.za", 587);
        client.Send(MailMsg);
        // Redirect to notification page
    }
}

You can however use the Windows CDO.Message object to send mail, as long as you follow the rules above.

Examples can be found at ... http://www.w3schools.com/asp/asp_send_email.asp


Back to top