title: How to check if Siebel has successfully delivered an email?
body: <p>We send a lot of email messages from our Siebel 7.8 application, and we'd like to determine whether they have been successfully delivered or not.</p>
  
  <p><a href="http://docs.oracle.com/cd/B31104_02/books/CommSrvAdm/CommSrvAdm_EmailOther8.html#wp1005586" rel="nofollow noreferrer">According to the Bookshelf</a>, if the SMTP server is down, the Communications Outbound Manager retries to send the message later, so that's not a problem. However, there are still plenty of issues which could cause an email to not be delivered, such as a typo in the address, the receiver having reached its storage quota, etc.</p>
  
  <p>We send our messages this way:</p>
  
  <pre class="lang-js prettyprint-override"><code>var ps = TheApplication().NewPropertySet();
  ps.SetProperty("ActivityId", outboundEmailActivityId);
  ps.SetProperty("CommProfile", commProfile);
  ps.SetProperty("ProcessMode", "Local");
  
  var bs = TheApplication().GetService("Outbound Communications Manager");
  bs.InvokeMethod("SendMessage", ps, psOut);
  </code></pre>
  
  <p>Using <code>ProcessMode = Local</code> allows us to detect a few errors. For example, if we try to send a message to a non-existant account in the same domain of our SMTP server, it returns <code>550 Unknown user</code> and then <code>503 Must have sender and recipient first</code>. The Outbound Communications Manager raises an exception, and we capture and handle it.</p>
  
  <p>However, if we send a message to a non-existant account in a different domain, our SMTP server can't know that it will fail, and therefore it returns <code>250 Queued</code>, and our code completes successfully. Later (it can range from seconds to a few hours later), we will receive a "Message undeliverable" error message, but at this point we only know that an outbound message failed, we don't know which one.</p>
  
  <p><strong>Is there any way in which Siebel can handle these 'Message undeliverable' notifications automatically?</strong></p>
  
  <p>We are thinking of writing our own process for that, but it seems like a huge task: we'd have to parse the delivery failure notification, identify the failing recipient, search for all the recent messages sent to that address, and somehow, guess which one failed (based on the Message-Id if we are lucky and can read it within Siebel, or on the Subject otherwise).</p>