SSK Source Update

Use of deprecated classes in SSK.Server.SendMail class. It's using System.Web.Mail namespace classes for sending e-mail, while .NET Framework 2.0 has a new namespace for sending e-mails, namely System.Net.Mail.

Below is an updated version of the "sendmail.cs" file inside the App_Code folder of the sharewareservice part of SSK.

This update makes it possible to send e-mail from your localhost without IIS SMTP Service installed.

using System;
using System.Net.Mail;
using System.Configuration;
using System.Data.SqlClient;
using Microsoft.ApplicationBlocks.Data;

namespace SSK.Server
{
/// <summary>
/// Summary description for SendMail.
/// </summary>
public class SendMail
{

private MailMessage _message;

//constructor
public SendMail() { }

/// <summary>
/// Send an email to the user with their license information
/// </summary>
/// <param name="invoice">The invoice for the transaction</param>
/// <param name="authLicense">The product key generated by the system.</param>
public void SendMailApprovedLicense(string invoice, string authLicense)
{
SqlDataReader reader = SqlHelper.ExecuteReader(ConfigurationSettings.AppSettings["SQLConnectionString"], "SendMailApprovedLicense", invoice);

if (reader.HasRows)
{
reader.Read();
string body;
string to = (string)reader["Email"];
string subject = "Your product has been activated.";
body = "<table width=\"500\"><tr><td>";
body += "Dear " + (string)reader["Firstname"] + ",<br><br><br>";
body += "Thank you for activating your product. Please make a note of the following information ";
body += "for future reference:<br><br>";
body += "</td></tr>";
body += "<tr><td width=\"500\">";
body += "Product Key: " + invoice + " ";
body += "<br><br>";
body += "</td></tr>";
body += "<tr><td>";
body += "Thank you,<Br>";
body += ConfigurationSettings.AppSettings["FromName"] + "<br><br>";
body += ConfigurationSettings.AppSettings["FromEmail"];
body += "</td></tr>";
body += "</table>";

try
{
Send(subject, body, to);
}
catch
{
//fail gracefully if the mail doesn't send
}
}
}

public void Send(string subject, string body, string to)
{
_message = new MailMessage();
_message.IsBodyHtml = true;
_message.From = new MailAddress(ConfigurationSettings.AppSettings["FromEmail"]);
_message.Subject = subject;
_message.Body = body;
_message.To.Add(to);

SmtpClient smtp = new SmtpClient(ConfigurationSettings.AppSettings["SMTP"]);
smtp.Send(_message);
}
}
}