How to validate SMTP check while sending an Email.
if we give "email@example.com" then it is showing exception "Wrong To Mail address." but if we give "firstname.lastname@example.org" then it is not giving any exception and it shows mail send. but is is non existing mail id. so can you please tell me how to validate SMTP check
i have a code for this validation but that one is in .NET
If the mail server doesn't exist (as I assume would be the case for gmail111.com) then that's detected right away because no network connection can be established. But for most other problems (non-existing account, closed account, account full, account temporarily unavailable etc.) the target mail server may accept the mail at first, and then bounce it later. So the "From" (or "Reply-To") address should be prepared to receive bounces that indicate failures, and handle those appropriately.
posted 11 years ago
thanks for reply ...
i got reply from email@example.com but is there is any other way to handle that one. because what i am doing is, is exception occurred while sending email then i am storing that mail in EMP_EMAIL table is exception occur while sending email. then status will be E (Error). and is sent successfully then status will be "S"
and if the status is E then i am allowing registry user to re-send that mail. but as i am not getting any exception then it is inserting status as sent even if that one is non-existing mail id.
posted 11 years ago
You could set up a background thread that periodically connects to the sending mail account, and which scans all incoming mails for failures. It can then change the DB records as appropriate. Note that bounces can take days to arrive. And since email is not a guaranteed delivery medium, you can never be sure that a mail actually got delivered (for example, the server may decide that it's spam and delete a mail without notifying anyone).
The bottom line is: Just because a mail was sent does not mean that it got delivered to the intended recipient. Often you'll receive a bounce mail when it did NOT get delivered, but you can't be sure of that. Even if you do get one, it can take days to arrive. You'll need to make allowances for all of this.
posted 11 years ago
but that solution doesn't sound very good..
let it be as earlier one..
registry user can send it via mail box.
It might work. I have not tested it personally because my ISP provider has blocked port 25. But I have seen similar scripts (using the same logic as the Java code) in ASP and PHP which are running and are available on websites to test email ids. I wanted to test the script myself and tried it on Google App engine but they do not support some of the Socket programming and I also tried on a server from godaddy.com but had some security issues so it did not work. Will try to contact my ISP and get port 25 unblocked for a few days and test the code.
If you read the document linked to, you will see a long list of reasons why an attempt to find whether a specific e-mail address exists on a server might fail. Not mentioned is the common occurrence that an e-mail address exists, but nobody ever reads messages sent to it.
Basically this approach is a dead end. Servers don't want to expose their user lists, because of the obvious risk of spam, and they are going to take more and better measures to prevent you from getting them. So don't take the spammer approach. Really you don't need to know in advance if an e-mail address exists, do you? If you're having a problem with that then you ought to take a second look at your system design to see why people are giving you bogus addresses.
posted 10 years ago
I agree with you. But the my friend wanted to check email ids of employees of different companies and when we checked such email ids with php and asp script it did work. The cases where it failed were like yahoo.com and in some cases for gmail.com as well. But it did work with my university email server and my friends companies mail server. You may check it on the following link.