It is a little unclear what you are after here. Where are you calling sendmail from? I assume from a CGI program hosted somewhere. If so, it depends on the type of error you're getting. If delivery failed because sendmail returned an error code, you can obviously test for that.

If delivery is failing and being reported back with a bounce, that won't be recorded in the sendmail logs, AFAIK. What will happen is that a bounce will be generated and e-mailed to the originator of your message (using the reply-to address I guess).

So ... you could do something like have procmail running somewhere in some special user account, invoking a script that you've written which parses bounce e-mails. Make sure the user running procmail is set as the reply-to of outgoing e-mails. Attach an X-header so you can match up replies with transmission attempts. And Bob's your father's brother.

Seems like the best way to me - because if your hosting service's sendmail can't transmit the message, *it* will return a bounce. But what if the remote mailbox is full? Then the destination SMTP server will generate the bounce, and your hosting service's sendmail will calmly deliver that without a second glace. Sendmail doesn't parse incoming e-mails to determine whether they are bounces for something it has transmitted in the past. So your hosting providers logs of bounces (if they exist) won't contain the whole story.

Just thinking off the top of my skull, HTH - HAND.

--
Ash OS durbatulk, ash OS gimbatul,
Ash OS thrakatulk, agh burzum-ishi krimpatul!
Uzg-Microsoft-ishi amal fauthut burguuli.


In reply to Re: SendMail works 99% of the time by hagus
in thread SendMail works 99% of the time by Elliott

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.