sendmail should throw an exception but does not

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Clodoaldo

    sendmail should throw an exception but does not

    I need to know if an email was refused for whatever reason, it makes
    no difference.

    The email is sent to an email address that does not exist in a foreign
    domain. I can see in the postfix log that the email was sent and
    bounced with the error code 550.

    The problem is that sendmail should throw an exception but it does
    not. And the returned dictionary is empty as if the email was
    accepted.

    d = smtpserver.send mail(sender, recipient, m.as_string())

    I guess that the error code returned by the destination mail server is
    not is not forwarded to the client by my mail server.

    Regards, Clodoaldo Pinto Neto
  • Jarek Zgoda

    #2
    Re: sendmail should throw an exception but does not

    Clodoaldo napisa³(a):
    I need to know if an email was refused for whatever reason, it makes
    no difference.
    >
    The email is sent to an email address that does not exist in a foreign
    domain. I can see in the postfix log that the email was sent and
    bounced with the error code 550.
    >
    The problem is that sendmail should throw an exception but it does
    not. And the returned dictionary is empty as if the email was
    accepted.
    >
    d = smtpserver.send mail(sender, recipient, m.as_string())
    >
    I guess that the error code returned by the destination mail server is
    not is not forwarded to the client by my mail server.
    Your local smtpd accepted the message for delivery, so everythong seems
    to be OK. Following communication takes place between mail servers, so
    your program has no possibility to know anything went wrong.

    --
    Jarek Zgoda
    Skype: jzgoda | GTalk: zgoda@jabber.as ter.pl | voice: +48228430101

    "We read Knuth so you don't have to." (Tim Peters)

    Comment

    • D'Arcy J.M. Cain

      #3
      Re: sendmail should throw an exception but does not

      On Tue, 25 Mar 2008 06:39:57 -0700 (PDT)
      Clodoaldo <clodoaldo.pint o@gmail.comwrot e:
      I need to know if an email was refused for whatever reason, it makes
      no difference.
      >
      The email is sent to an email address that does not exist in a foreign
      domain. I can see in the postfix log that the email was sent and
      bounced with the error code 550.
      That's the sendmail daemon, not your program.
      The problem is that sendmail should throw an exception but it does
      not. And the returned dictionary is empty as if the email was
      accepted.
      >
      d = smtpserver.send mail(sender, recipient, m.as_string())
      What this does is connect to your sendmail server and submit the email
      for sending. The server accepts the email and queues it up as asked.
      No error here.
      I guess that the error code returned by the destination mail server is
      not is not forwarded to the client by my mail server.
      It can't. By the time it finds out that there is a problem you have
      already closed the connection to the sendmail server.

      To do what you want you have to connect to the remote server yourself.
      This is a more complicated operation and there are still problems.
      First of all, your ISP may not allow you to connect to remote mail
      servers. Second, some [broken] mail servers will accept your email and
      only check and bounce after you have disconnected.

      I'm not sure what you are trying to do but you may want to consider
      using an Error-to: header that points to an email robot and manage
      bounces asynchronously.

      --
      D'Arcy J.M. Cain <darcy@druid.ne t | Democracy is three wolves
      http://www.druid.net/darcy/ | and a sheep voting on
      +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.

      Comment

      • Clodoaldo

        #4
        Re: sendmail should throw an exception but does not

        2008/3/25, D'Arcy J.M. Cain <darcy@druid.ne t>:
        On Tue, 25 Mar 2008 06:39:57 -0700 (PDT)
        Clodoaldo <clodoaldo.pint o@gmail.comwrot e:
        I need to know if an email was refused for whatever reason, it makes
        no difference.
        >
        The email is sent to an email address that does not exist in a foreign
        domain. I can see in the postfix log that the email was sent and
        bounced with the error code 550.
        >
        >
        That's the sendmail daemon, not your program.
        >
        >
        The problem is that sendmail should throw an exception but it does
        not. And the returned dictionary is empty as if the email was
        accepted.
        >
        d = smtpserver.send mail(sender, recipient, m.as_string())
        >
        >
        What this does is connect to your sendmail server and submit the email
        for sending. The server accepts the email and queues it up as asked.
        No error here.
        >
        >
        I guess that the error code returned by the destination mail server is
        not is not forwarded to the client by my mail server.
        >
        >
        It can't. By the time it finds out that there is a problem you have
        already closed the connection to the sendmail server.
        >
        To do what you want you have to connect to the remote server yourself.
        This is a more complicated operation and there are still problems.
        First of all, your ISP may not allow you to connect to remote mail
        servers. Second, some [broken] mail servers will accept your email and
        only check and bounce after you have disconnected.
        >
        I'm not sure what you are trying to do but you may want to consider
        using an Error-to: header that points to an email robot and manage
        bounces asynchronously.
        Thanks for the objective answer. I'm now reconnected to reality. The
        problem i'm trying to solve is to check if an email address is valid.

        That email address is used to register in a site. I'm already doing
        the confirmation email path. The confirmation email prevents someone
        to register with a forged email but also prevents those who simple
        don't know exactly what their email is. Yes the email must be typed
        twice but still people get the email wrong just because they don't
        know for sure what it is. I can see it clearly when they mistype the
        correct domain.

        It happens that atracting those people is expensive and i can't afford
        to loose them. Thats why i would like to check the email at
        registration time. Also those who try to register with a forged email
        would learn that the email must be confirmed and could then issue a
        correct email.

        I guess it is not possible or is too complex because i never saw it done.

        Regards, Clodoaldo Pinto Neto

        Comment

        • Jarek Zgoda

          #5
          Re: sendmail should throw an exception but does not

          Clodoaldo napisa³(a):
          That email address is used to register in a site. I'm already doing
          the confirmation email path. The confirmation email prevents someone
          to register with a forged email but also prevents those who simple
          don't know exactly what their email is. Yes the email must be typed
          twice but still people get the email wrong just because they don't
          know for sure what it is. I can see it clearly when they mistype the
          correct domain.
          >
          It happens that atracting those people is expensive and i can't afford
          to loose them. Thats why i would like to check the email at
          registration time. Also those who try to register with a forged email
          would learn that the email must be confirmed and could then issue a
          correct email.
          >
          I guess it is not possible or is too complex because i never saw it done.
          Good guess -- this is not possible until you (or your server) actually
          send an email.

          You can send a big "THANKYOU" to spammers, because their activity caused
          nearly all mail server admins to disable VRFY command that is supposed
          to do what you need.

          --
          Jarek Zgoda
          Skype: jzgoda | GTalk: zgoda@jabber.as ter.pl | voice: +48228430101

          "We read Knuth so you don't have to." (Tim Peters)

          Comment

          Working...