0

From time to time I get blocked by hotmail servers.

The reason, as far as I digged in, is because my server is sending mails for non-existing users.

Hotmail seems to interpret these attempts as "if the user doesn't exist and you are attempting to mail it, you might be a spammer".

Since my DB is a bit old (has records from ~7 years ago), some emails, indeed, no longer exist - as well as some mail servers.

Two Scenarios: bad user input and inexistent email

  1. BAD USER INPUT

John's email is johndoe@hotmail.com

But he inputs it as:

johndeo@hotmail.com

johndoe@ohtmail.com

Obviously, it will fail to deliver and Hotmail may interpret these attempts as email mining.

  1. INEXISTENT EMAIL

Hotmail mail accounts are deleted after a certain period* of inactivity. That said, obviously, I can't mail them.

When a user tries to recover his account at my server, it may happens that the email he used to sign up isn't used by him and it no longer exists. I cannot know or control that and then the account recovery email will be sent anyway. Again, Hotmail may interpret it as email mining, since the best practices establishes that "one should know his receiver's correct and updated email".

*365 days as of this article: my hotmail has been deleted


HOW CAN I FIND OUT IF AN EMAIL EXIST?

How can I find if an email exists beforehand sending it my message?

The moment the user clicks the "Forgot Password" link and inputs his email, what PHP measures can I take to let him know that he inputted a non-existing email?

Rafael Vidal
  • 333
  • 4
  • 17
  • You can use a sending service like SendGrid, which reports back to you any blocked/non-deliverable addresses. Not useful in your initial message to the user, but useful to clean your database. – Patrick Moore Aug 22 '16 at 23:00

1 Answers1

0

To validate the format of an email in PHP use filter_var().

if (filter_var($email_a, FILTER_VALIDATE_EMAIL)) {
    ...
}

-- http://php.net/manual/en/filter.examples.validation.php

The only way to validate whether or not an email address exists and can receive email is to send an email to that address and receive some kind of response, either a reply, a bounce message or a link clicked from within the email.

Asaph
  • 159,146
  • 25
  • 197
  • 199
  • I've avoided the word "validate", because it's not the case. This kind of verification (filter_validate_email) I'm doing. What I really need to do is to know if the email address exists, in order to prevent sending mail to non-existing users. – Rafael Vidal Aug 22 '16 at 23:25
  • As I stated in the 2nd part of my answer: The only way to confirm an email address exists is to send an email and receive a response. Anything short of that would be a goldmine for email harvesting. – Asaph Aug 22 '16 at 23:27
  • @RafaelVidal Since this was reopened, I'll just point you to [this answer](http://stackoverflow.com/a/19262381/2370483) I posted on another similar question. There are "hacky" ways of validating some email addresses but all have caveats – Machavity Aug 22 '16 at 23:35
  • Yes, I got your point, Asaph. I have to send the email to determine if it exists. But wouldn't it hurt my sending score to continuously send emails to non-existing users? – Rafael Vidal Aug 22 '16 at 23:37
  • @Machavity That answer has many downvotes, and with good reason. The *only* reliable way is to send an email and receive a positive response. – Asaph Aug 22 '16 at 23:39
  • @RafaelVidal I'm sorry I don't have a magic shortcut for you on this one but there simply is no other way. You may just be out of luck on this one. – Asaph Aug 22 '16 at 23:41
  • @Asaph Uhm... did you read the link in my previous comment? That's *exactly what I said* – Machavity Aug 22 '16 at 23:42
  • @Machavity, yeah, I've read your link and comments, thank you for your attention. Seems I'm helpless at this point. – Rafael Vidal Aug 24 '16 at 03:22