• Post Reply Bookmark Topic Watch Topic
  • New Topic

Before Sending Emails

 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) I am editing my message to make more to the point that I don't need any regex to check the syntax that it has @ and dot or not like these things.

2) I need to know that how can decided about the email that it'll not be bounced?

Thanks & regards
[ November 04, 2008: Message edited by: Farakh khan ]
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) You can use the InternetAddress class and its constructors to verify email addresses.

2) You can't determine whether or not a message will be bounced until the message is actually sent. There are multiple reasons a message can be bounced:
  • The email server does not exist. InetAddress.isReachable can help you with finding out.
  • The SMTP port is closed. Socket can help you with finding out. Of course a Socket can also help you find out if the email server exists; if it doesn't the socket will fail as well.
  • The mailbox is invalid for the mail server. You can't find out before sending.
  • The mailbox is full. You can't find out before sending.

  • This list is not exhaustive; there are probably dozens of more reasons a mail server can reject (bounce) your message. But the fact remains: all you can test before sending is whether or not the server is actually up.
     
    Farakh khan
    Ranch Hand
    Posts: 833
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by Rob Prime:
    1) You can use the InternetAddress class and its constructors to verify email addresses.

    2) You can't determine whether or not a message will be bounced until the message is actually sent. There are multiple reasons a message can be bounced:
  • The email server does not exist. InetAddress.isReachable can help you with finding out.
  • The SMTP port is closed. Socket can help you with finding out. Of course a Socket can also help you find out if the email server exists; if it doesn't the socket will fail as well.
  • The mailbox is invalid for the mail server. You can't find out before sending.
  • The mailbox is full. You can't find out before sending.

  • This list is not exhaustive; there are probably dozens of more reasons a mail server can reject (bounce) your message. But the fact remains: all you can test before sending is whether or not the server is actually up.

    Thanks a trillion
     
    Joe Ess
    Bartender
    Posts: 9362
    11
    Linux Mac OS X Windows
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by Rob Prime:
    1) You can use the InternetAddress class and its constructors to verify email addresses.


    InternetAddress verifies addresses according to rfc 822 which does not require a top level domain for an address. For example, "joe" is perfectly valid under the rfc, but will probably not resolve to a destination.
     
    Rob Spoor
    Sheriff
    Posts: 20822
    68
    Chrome Eclipse IDE Java Windows
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Except when you use the strict flag, and set it to true. Of course saying things like rob@com will be allowed, but then again, technically it IS. A TLD is a domain, and technically the maintainers could put a mail server on that domain. Especially if TLDs will become for sale (which has already been the case in the past with a nasty company called UNIDT, and I've read there are similar plans again) that would be perfectly possible.
     
    Paul Clapham
    Sheriff
    Posts: 21892
    36
    Eclipse IDE Firefox Browser MySQL Database
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by Farakh khan:
    1) I am editing my message to make more to the point that I don't need any regex to check the syntax that it has @ and dot or not like these things.

    2) I need to know that how can decided about the email that it'll not be bounced?
    If you design your application correctly, you should not have to validate any e-mail addresses. Here's how you do that design: make sure that the user wants to receive e-mails from you. When that happens, the user will make sure to input his e-mail address correctly.

    If you have a design where you require an e-mail address, and the user isn't sure that he wants to get e-mails from you, the user is going to put junk in that field. If you try to validate it, the user will then put in valid-looking junk. So validation doesn't do anything for you there.
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!