sendmail should throw an exception but does not

C

Clodoaldo

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.sendmail(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
 
J

Jarek Zgoda

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.sendmail(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.
 
D

D'Arcy J.M. Cain

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.sendmail(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.
 
C

Clodoaldo

2008/3/25 said:
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.sendmail(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
 
J

Jarek Zgoda

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top