in reply to sendmail trouble

Check out Email::Valid and use it to validate the destination email addresses before trying to send the email.

Also in my not so humble opinion using a module like MIME::Lite or Mail::Send can save you a lot of grief.


Peter L. Berghold -- Unix Professional
Peter at Berghold dot Net
   Dog trainer, dog agility exhibitor, brewer of fine Belgian style ales. Happiness is a warm, tired, contented dog curled up at your side and a good Belgian ale in your chalice.

Replies are listed 'Best First'.
Re: Re: sendmail trouble
by barrd (Canon) on Sep 05, 2003 at 16:22 UTC
    Hi there blue_cowdawg,
    Not meaning to tread on your toes but your answer could be a little misleading regarding Email::Valid, E::V cannot validate that the actual address is correct, only that there is an MX record for the domain (which is what I think you meant*) and that the address itself is RFC822 compliant.

    /me scuttles away quickly from flying detritus

    * This uses Net::DNS and is hellishly slow if the MX cannot be verified.

          Not meaning to tread on your toes
      Don't worry... I wear steel toed sandals here at The Monastary! ;-)

          E::V cannot validate that the actual address is correct, only that there is an MX record for the domain
      Agreed, and in my at the time caffeine deprived state I read between the lines and came to the conclusion that the trouble the OP was running into was Sendmail barfing on the email address. The only things I can think of that would cause that would be
      1. The address is malformed (not the case IIRC)
      2. The domain doesn't exist or lacks an MX
      3. It is an address from the local domain that is wrong
      4. Stuff I can't think of right now...
      In the first two cases Email::Valid is a legitimate tool. I do, however, stand by my answer of using Mail::Send or MIME::Lite instead of piping into sendmail.

          This uses Net::DNS and is hellishly slow if the MX cannot be verified.
      Actually this is a case where YMMV depending on a number of factors. I've used the module extensively under all sorts of conditions and for the exceptions of some boundary conditions it has worked well for me. A misconfigured DNS client or server can cause you problems but those issues are out of scope here.


      Peter L. Berghold -- Unix Professional
      Peter at Berghold dot Net
         Dog trainer, dog agility exhibitor, brewer of fine Belgian style ales. Happiness is a warm, tired, contented dog curled up at your side and a good Belgian ale in your chalice.
        Don't worry... I wear steel toed sandals here at The Monastary! ;-)
        Good, glad to hear I didn't offend. And I also concur that Mail::Lite (which is my personal choice) is an excellent module to use rather than piping to sendmail (or any other MTA).