elmas156 Posted January 10, 2011 Share Posted January 10, 2011 Hello everyone, I have a site where users sign up using an email address as their username. I want to be able to verify that their email address is valid without having to send them a confirmation email that they have to click some link in before they are allowed to sign in to the website. Maybe something that pings the email server for a specific address, and if the address is not valid, alert the user to enter a valid address. Does anyone have any ideas or information that you could point me to to assist me with this task? Thanks in advance for any help or ideas. Quote Link to comment Share on other sites More sharing options...
btherl Posted January 10, 2011 Share Posted January 10, 2011 You can connect to the mail server with SMTP and ask to send an email to that address, then cancel. It's not guaranteed to work but it's better than nothing. Keep in mind that you need to look up the MX DNS record for a domain to find where to connect to - if you just connect to the domain itself you might not find the SMTP server there and you'll get a false negative result for the test. There's an overview of the SMTP protocol in this article: http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol MX records: http://en.wikipedia.org/wiki/MX_record Yes it's complicated - that's why most sites send an email instead Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 10, 2011 Share Posted January 10, 2011 Not only that, but all anyone would have to do would be to supply a valid address, it wouldn't necessarily have to be their address. The point of sending a confirmation email, IMO is to make sure the email address belongs to the person registering. Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 10, 2011 Share Posted January 10, 2011 I'll also add that for my personal domain I use a "redirect" address. For example, any email sent to me@mydomain.com will be redirected to me@myispdomain.com. So, trying to "validate" my email will fail. I agree with Pikachu2000. Simply validating that they have supplied a valid email address tells you nothing. Quote Link to comment Share on other sites More sharing options...
btherl Posted January 11, 2011 Share Posted January 11, 2011 mjdamato, why would validation fail for the redirect address? If email can be sent to me@mydomain.com, then the MX for mydomain.com must be accepting mail addressed to "me". Quote Link to comment Share on other sites More sharing options...
elmas156 Posted January 11, 2011 Author Share Posted January 11, 2011 OK, so I guess I'm going to be sending a confirmation email. Here is another question though: When an email is automatically sent using the mail() function, sometimes it takes up to 10-15 minutes. Is there any way to speed that up or does it have something to do with my server? I would like for it to take no more than 5 minutes, ideally less than 2 minutes. Ideas on this? Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 11, 2011 Share Posted January 11, 2011 Some hosting companies queue outbound mail and send it on a schedule, so that may be what's causing it. Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 11, 2011 Share Posted January 11, 2011 mjdamato, why would validation fail for the redirect address? If email can be sent to me@mydomain.com, then the MX for mydomain.com must be accepting mail addressed to "me". I can only say that I have had problems receiving emails to certail addresses from certain domains and the only parameter I could not rule out was that the accounts experiencing the problem were redirects. I assumed - possibly incorrectly - was that the sneding server was doing some type of check. Quote Link to comment Share on other sites More sharing options...
elmas156 Posted January 11, 2011 Author Share Posted January 11, 2011 Thanks Pikachu2000, do you know if there is any way to change that other than getting a new hosting company? Quote Link to comment Share on other sites More sharing options...
phil88 Posted January 11, 2011 Share Posted January 11, 2011 They probably have a queue for a reason. Your best bet would be to ask them exactly what the situation is and if there's a way around it. Failing that, you could send the email using a different email provider and not use PHP's mail function. I've had a good experience with Swiftmailer before. You could probably use it to send through gmail (500 email per day limit) or some other provider. Quote Link to comment Share on other sites More sharing options...
elmas156 Posted January 11, 2011 Author Share Posted January 11, 2011 Thanks for the info! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.