Check validity of domain
Posted: Thu Jan 15, 2004 10:22 am
Hello,
I have an email program that sends emails to my customer. However if the domain of the email is incorrect or their mail client is down I'm getting an error.
for example: (assuming that thisdomaindoesnotwork.com doesn't work)
Bad email: name@thisdomaindoesnotwork.com
This would cause an error because thisdomaindoesntowork.com is not a legit domain name.
Some thoughts I had were as follows but I'm not sure if I'm taking the right approach.
Use fopen() to open the webpage.
[syntax=php]fopen("http://www.thisdomaindoesnotwork.com");[/syntax]
Error check this to see if its unable to read the file then don't send email.
Potential problems:
The server locked/secure or doesn't have a page on the domain.
The domain is accessible by http://thisdomaindoesnotwork.com but not http://www.thisdomaindoesnotwork.com
The email domain is not the same as their web page therefore their email domain is unreachable via php’s fopen() function.
Thanks for the help.
I have an email program that sends emails to my customer. However if the domain of the email is incorrect or their mail client is down I'm getting an error.
for example: (assuming that thisdomaindoesnotwork.com doesn't work)
Bad email: name@thisdomaindoesnotwork.com
This would cause an error because thisdomaindoesntowork.com is not a legit domain name.
Some thoughts I had were as follows but I'm not sure if I'm taking the right approach.
Use fopen() to open the webpage.
[syntax=php]fopen("http://www.thisdomaindoesnotwork.com");[/syntax]
Error check this to see if its unable to read the file then don't send email.
Potential problems:
The server locked/secure or doesn't have a page on the domain.
The domain is accessible by http://thisdomaindoesnotwork.com but not http://www.thisdomaindoesnotwork.com
The email domain is not the same as their web page therefore their email domain is unreachable via php’s fopen() function.
Thanks for the help.