public void llEmail(string address, string subject, string message)
{
m_host.AddScriptLPS(1);
IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface<IEmailModule>();
if (emailModule == null)
{
Error("llEmail", "Email module not configured");
return;
}
//Restrict email destination to the avatars registered email address?
//The restriction only applies if the destination address is not local.
if (m_restrictEmail == true && address.Contains(m_internalObjectHost) == false)
{
UserAccount account =
World.UserAccountService.GetUserAccount(
World.RegionInfo.ScopeID,
m_host.OwnerID);
if (account == null)
{
Error("llEmail", "Can't find user account for '" + m_host.OwnerID.ToString() + "'");
return;
}
if (String.IsNullOrEmpty(account.Email))
{
Error("llEmail", "User account has not registered an email address.");
return;
}
address = account.Email;
}
emailModule.SendEmail(m_host.UUID, address, subject, message);
ScriptSleep(m_sleepMsOnEmail);
}