Thank you for the replies - I have found a solution!
The Authentication requirement is a red herring; simply remove all reference to it and the problem goes away. The following code sends a email to a user (of the standard ASP.NET membership system):
Code:
///<summary>
/// Send an email to the user.
///</summary>
///<param name="mu">User to send email to</param>
///<param name="body">Text to send</param>
///<param name="subject">Seubject line</param>
///<param name="from">Subaccount to send from. If null or empty, NoReply will be used.</param>
publicstaticvoid SendUserEmail(MembershipUser mu, string body, string subject, string from)
{
if (string.IsNullOrEmpty(from))
{
from = "NoReply";
}
try
{
MailMessage mail = newMailMessage();
mail.Body = body;
mail.IsBodyHtml = true;
mail.To.Add(newMailAddress(mu.Email));
mail.From = newMailAddress(from + strEmailAccountBase, from + strEmailAccountBase, Encoding.UTF8);
mail.Subject = subject;
mail.SubjectEncoding = Encoding.UTF8;
mail.Priority = MailPriority.Normal;
SmtpClient smtp = newSmtpClient();
smtp.Host = "mail.XXX.x10hosting.com";
smtp.Port = 26;
smtp.Send(mail);
}
catch (Exception ex)
{
thrownewApplicationException("Could not send email", ex);
}
}