How can we know wheter a mail is sent successfully?

 Consider this:If a user enters a supperfically valid email ,such as rtr2@xr2f.xyz,which is essentially invalid,and the program attempts to send a mail to this address.The result of sending this email will be failure,but how can we know the result?
  I use JMail to send email,and I know the method send of JMail.Message would return False,
which indicates the sending fails.but the value False seems to be the result of some configuration errors(eg. an invalid account which is used to send mail is provided. )
LVL 1
hengzheAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sajuksCommented:
Sorry you can't know if the account was an invalid one ...you'll get later an error from the mailserver postmaster of undelivered mail .
The only validation that you could perform is whether the email entered was in the right format. And thats it.
0
arantiusCommented:
You could manually connect a socket to port 25 of the appropriate mail server (Yes, you'll have to look up the MX records to find the appropriate server) and issue a VRFY command.
0
hengzheAuthor Commented:
  I once activated my account in Yahoo.In the process of activation,an email address was required,but I just entered  henzhe@yahoo.com.cn(in fact,I don't have such an email in Yahoo),and the page prompted that 'please provide a valid email'.
  Does this mean Yahoo could regconize invalid email account?
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

sajuksCommented:
Thats cos its searching its own server. If you are the email provider then you've the database where you store all the emails. You can then do a select to check whether the data exists in your d/b and confirm its validity
0
jmelikaCommented:
Here is a link to a site with examples on how to do that using different web languages.
http://www.cfdev.com/email/verify/index.cfm

Good luck!
JM
0
Yrag1Commented:
Hi, if u r using asp.net you can validate the domain ie

<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Net.Sockets" %>

strIP = DNS.Resolve("yahoo.com").AddressList(0).ToString()
 
theres a bit more code but essentially the DNS.Resolve method will return an IP address if the domain is valid.

If u r not using .net then i dont know.

Gary
0
arantiusCommented:
Yrag1:
Yes, but you need to look up the MX records, not the A record.  Especially a domain as big as yahoo, different machines handle the web and the mail.
0
alexmayCommented:
Isn't the best way, the easiest and classic method?
That would be to send the user a mail with a code and require him to read and respond with the code.
If the address was not valid, he would not get the mail.
Otherwise, the code can be used to continue the script.
0
hengzheAuthor Commented:
Yes,alexmay,I did it. But I just want to enable the program not to attempt to send out a mail if an invalid receipient address is supplied.
0
sajuksCommented:
hengzhe i think that the best that you can do is check whether the email entered is valid or not in the page.There will be cases where the person enters a wrong email address cos he/she just wants to download the stuff and doesnt want to register(receive mail) for anything .Are you trying to prevent such cases ? Then once condition that you could add is send the download link directly to the email id provided. That way you can atleast ensure somewhat that the id provided is a valid one.
Using Jmail or any other mail tool you wont be able to achieve what you want.
0
alexmayCommented:
I don't think you can be really sure of the validity without actually sending the mail and getting the user to read and respond, but...
You could ping the domain mail server to at least see if that gives a reply.
That might reduce the mail send failures a bit.
0
hengzheAuthor Commented:
On thing about JMail I am quite sure: send method of JMail.Message would return False if the account which is used to send the mail is wrongly provided(for example,the password is mistyped.).According to this,before sending a mail to a specified receipient(one@mail.com),can we use  the account one@mail.com,though we don't the password,
to log on mail.com,and hence to see whether there is such a user as 'one' on mail.com?If this can be achieved,then validity of the receipient is naturally decided.
0
sajuksCommented:
Jmail.Message also fails if the Jmail connection is not proper, internet connection is down ,
syntax error.To log onto jmail.,message you need both username and password as valid.
Just a username wont work as it will still return a false
0
hengzheAuthor Commented:
I found the solution:
Set message.logging=true and analyze message.log which is a string reporting the result of an attempt to send an email.
if the sending failed,such string as '1 of 1 servers failed' could be found in message.log.Hence,we could determine whether the email was successfully sent or not.
0
sajuksCommented:
i'd recommend PAQ with points refunded.
0
moduloCommented:
PAQed with points refunded (300)

modulo
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.