473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

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.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
Mar 25 '08 #1
4 1782
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.

--
Jarek Zgoda
Skype: jzgoda | GTalk: zg***@jabber.aster.pl | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)
Mar 25 '08 #2
On Tue, 25 Mar 2008 06:39:57 -0700 (PDT)
Clodoaldo <cl*************@gmail.comwrote:
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.

--
D'Arcy J.M. Cain <da***@druid.net | 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.
Mar 25 '08 #3
2008/3/25, D'Arcy J.M. Cain <da***@druid.net>:
On Tue, 25 Mar 2008 06:39:57 -0700 (PDT)
Clodoaldo <cl*************@gmail.comwrote:
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
Mar 25 '08 #4
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: zg***@jabber.aster.pl | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)
Mar 25 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stefan Pantos | last post by:
Dear all, Could someone explain to me the proper use of throw()? As it is used for std::exception. I cannot find anything which describes how it should be used and all the information about...
4
by: Eric Lilja | last post by:
Hello, in my program I have a function (pseudo code): void start_mysql_service() { obtain handle start mysql service using handle if start fails close handle and throw an exception...
3
by: Pierre Rouleau | last post by:
The std::exception class defined in the Standard C++ <exception> header specifies that the constructors could throw any exception becuase they do not have a throw() specification. Why is that? ...
12
by: GoogleNewsReaderMan | last post by:
I want to "rethrow" an exception so as not to lose the original stack trace information. I understood that I could use throw, like: try { DoIt(); } catch (Exception ex) {...
6
by: Arjen | last post by:
Hi, I'm reading the enterprise library documentation and there I see the throw statement. try { // run code } catch(Exception ex) {
3
by: swangdb | last post by:
I have a Sun Server running Solaris 10 and Sendmail 8.13.7. I have Majordomo and Listproc installed on this server and they work. I have several production majordomo and listproc mailing lists...
24
by: Chameleon | last post by:
Is there a possibility to create memory leak, the code below if I run the line: --------------------------------------------------------- MyClass cl = new MyClass();...
6
by: Fir5tSight | last post by:
Hi, What does "throw" do? I understand that it throws an error when certain exceptional situation happens. My guess is that this *ignores* the error and *continues* so that it prevents the...
28
by: Jess | last post by:
Hello, It is said that if I implement a "swap" member function, then it should never throw any exception. However, if I implement "swap" non- member function, then the restriction doesn't...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.