add send error handling
parent
c16cd2f9cf
commit
b7a69bda80
|
@ -240,6 +240,8 @@ namespace OpenSim.Modules.EMail
|
|||
}
|
||||
|
||||
public void SendEmail(UUID objectID, string address, string subject, string body)
|
||||
{
|
||||
try
|
||||
{
|
||||
SceneObjectPart sceneObject = m_scene.GetSceneObjectPart(objectID);
|
||||
|
||||
|
@ -247,7 +249,7 @@ namespace OpenSim.Modules.EMail
|
|||
message.From.Add(new MailboxAddress(sceneObject.Name, sceneObject.UUID + "@" + SMTP_SERVER_SENDER));
|
||||
message.To.Add(new MailboxAddress("", address));
|
||||
message.Subject = subject;
|
||||
message.Body = new TextPart("plain"){Text = body};
|
||||
message.Body = new TextPart("plain") { Text = body };
|
||||
|
||||
message.Headers.Add(new Header(Encoding.UTF8, "ObjectID", sceneObject.UUID.ToString()));
|
||||
message.Headers.Add(new Header(Encoding.UTF8, "AvatarID", sceneObject.OwnerID.ToString()));
|
||||
|
@ -262,7 +264,7 @@ namespace OpenSim.Modules.EMail
|
|||
{
|
||||
client.Connect(SMTP_SERVER_HOSTNAME, SMTP_SERVER_PORT, SecureSocketOptions.Auto);
|
||||
}
|
||||
else if(SMTP_SERVER_TLS == true)
|
||||
else if (SMTP_SERVER_TLS == true)
|
||||
{
|
||||
client.Connect(SMTP_SERVER_HOSTNAME, SMTP_SERVER_PORT, SecureSocketOptions.StartTlsWhenAvailable);
|
||||
}
|
||||
|
@ -271,12 +273,17 @@ namespace OpenSim.Modules.EMail
|
|||
client.Connect(SMTP_SERVER_HOSTNAME, SMTP_SERVER_PORT, SecureSocketOptions.None);
|
||||
}
|
||||
|
||||
if(SMTP_SERVER_LOGIN != String.Empty && SMTP_SERVER_PASSWORD != String.Empty)
|
||||
if (SMTP_SERVER_LOGIN != String.Empty && SMTP_SERVER_PASSWORD != String.Empty)
|
||||
client.Authenticate(SMTP_SERVER_LOGIN, SMTP_SERVER_PASSWORD);
|
||||
|
||||
client.Send(message);
|
||||
client.Disconnect(true);
|
||||
}
|
||||
}catch(Exception _error)
|
||||
{
|
||||
m_log.Error("[" + Name + "] " + _error.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Email GetNextEmail(UUID objectID, string sender, string subject)
|
||||
|
|
Loading…
Reference in New Issue