Email Validation - c#

I am checking the validation for email using regular expression its working fine for me. What if the user give some dummy mailid in the textbox?
How can i check whether the entered mail is valid or not without telling the user to login to that mail and click subscribe link?
Is it possible to check like this..
Thanks in advance

How can i check whether the entered
mail is valid or not without telling
the user to login to that mail and
click subscribe link?
You can not. Point. Thanks to spammers no email server wil lbehave. Some will send you "user doesn ot exist" errors, some will even swallow them.
Plus, legally, youalso have to make sure the subscriber actually OWNS the mailbox, and is not entering someone else email.

The only way which i think is
Send an email to the specified email address , if you don't got a bounced email , email is valid provided by user

Without verifying that the user can actually read email, you can't ensure it's that user's real account.
Many domains accept all mail, and use it for spam analysis on invalid accounts, and a user can easily provide 'real' accounts they don't control. (eg: sales#example.com)

Related

Prevent a user from replying to a message

Is there any mechanism in which you can prevent a user from replying to an email message? Here's the use case:
An automated system (C#.net) sends emails to a user. The action of the task
is included in the email message (e.g. RSVP link for "yes" or "no")
Instead of using the buttons/actions in the email, the user replies
to the email.
The email originally sent specifically says that the mailbox in use
is unmonitored. (in bright red box!!!)
The user doesn't actually read the email, and gets pissed off when nobody replies or his RSVP is "lost"
Clearly a user issue. I'm thinking the best recourse might be an automated reply saying the mailbox is unmonitored if a user replies to the e-mail.
Any SMTP conditions/flag which can prevent a user from replying in the first place?
I don't believe there is any setting that you can include in the original email that would stop someone from replying to an email.
If the recipient really wants to reply, they can literally copy-paste the sender's email address into a new email and reply to it that way.
Just wanted to point out that the following hack is not elegant and would result in a bad customer experience. This is the only way I could think of achieving this.
One hack that comes to my mind is that you can try to set MailMessage.ReplyToList property to an invalid email address like - abc#g#g.com. In theory, this will force the customer's email client to reply to the invalid email address instead of the original sender. We can hope that the customer's email client validates that before sending the reply.
I have not tried this myself as I don't have an SMTP server to validate. But if the SMTP server does not validate the ReplyToList value then it should work.
Again this is a super sketchy hack and might not work with all the email clients out there.
You are better off setting up an auto-reply on the mailbox.

How to check whether user email id is existing or not using asp.net?

I have a form in my asp.net site. when user fills email id text box, I want to make sure whether that email id is valid or invalid(existing or not existing).
Ex: john#gmail.com is valid,
john#xxxyyy.com is not valid.
How to find it whether it is valid or not. please help me. I searched some stack overflow. even though I didn't get.
There is no way to for you to know if an email account actually exists other than to send an email and see what happens. A delivery failure notice might be sent, but that is not guaranteed to be sent, and even if it is, it might not be sent for days depending on how many delivery attempts are made.
You can send a verification email which contains a URL of a web service you control and passes a unique ID. The email owner clicks on the URL and is directed at your web service. You look at the unique ID and now you know the email address exists.
https://emailhunter.co/api/docs#email-verification - is a web service API to check email addresses
try to create an email id in mail server. if exist it will return an existing mail return message.
You could use the built-in Microsoft SmtpClient Class if you know the adress of your SMTP server. The Send Method returns an exception when the delivery fails. Again, this is only a suggestion and perhaps too overwhelming for what you need, but this class is rather useful in C#.
Send one link on that email address with some query string parameters and based on those parameters activate their user profile otherwise not activate..
So based on this methodology, you can verify email address is valid or not.

ASP.Net Membership Password recovery

Current state of Application
We got a huge user base currently and we had requiresUniqueEmail="false" setting from day one bcse business required such.
So our password recovery was done via UserName.
Issue/Problem
Suddenly the business wants the password recovery to be done either by Username or Email. But bcse we never had unique emails in the system (in few cases no email), we are having quite a few duplicate emails in the system. For example, xyz#xyz.com is assigned to 10 different usernames.
How can I tackle this situation in best possible way?
I was thinking along the lines, if a user selects by email, I will go ahead and send all the usernames which are associated with this email. Is that a good option?
Would love to have more ideas on this. I am sure someone should have had this sort of issue before.
When accounts were set up did it send out a validation email to ensure people only subscribed using email addresses they owned? If so then you could send out all username's safe in the knowledge the owner of the email created them. If you didn't require validation then possibly anyone could get the email and read someone else's account.
You can use email to narrow down to a single username recovery. For example:
Given a set of 10 usernames with the same email "email#domain.com"
When I click "Recover Password By Email"
And I enter "email#domain.com"
Then I should see the message "select which username you want to recover"
And I should see a list of the 10 usernames
When I click on the username "username1"
Then I should receive a password recovery email for the "username1" account
at the "email#domain.com" address
This way, you're still doing recovery by username, but only when the email has more than 1 username match.
I don't like the idea of sending the password recovery to all usernames. The user may have only forgotten one password.

How to connect gmail account through VC#

I want to write a simple program which has a username and password field when I click the button it should display a message box saying "Successful login" and connect with my gmail account.
The code should use Http header..
http://code.msdn.microsoft.com/CSharpGmail
You should be clearer about what you want - the title says
How to connect gmail account through VC#
For that, the answer given by FractalizeR is correct
If all you want is to show a message than that's another story, try:
MessageBox.Show("MessageTextHere", "CaptionTextHere")
Or any of it's many variants

Email id validation

In the new user registration page, how to check whether the email id entered by a user is valid? I want to check the entered email id actually exists before the user submits his information. Please do not give code for checking email id string using regular expression, I want to check whether the entered email id actually exists.
You can not "check" that reliably. You need to "ask", send an email to that address with a secret code that your users must enter on your site, or a link with the secret code that the user must click.
Edit: About the reliably part.
While an SMTP server may respond that a mail address is invalid they usually don't, because that would help spammers identify valid addresses more easily. That would also require your code to talk directly to the SMTP servers responsible for each domain. Usually you send mail though your local SMTP server that does the job of forwarding the mail to the right recipient(s).
What you can do however is at least check that the domain exists by asking your favorite DNS service.
In order to do this, you'd need to telnet to the email provider in order to check if it exists. Hotmail, for one, will not allow you to do this.
You should be using membership system for your ASP.net registration form.
Here is a good article explaining how it all works:
https://web.archive.org/web/20211020202857/http://www.4guysfromrolla.com/articles/120705-1.aspx
Including a page on how to verify email addresses like you describe
The only 100% accurate method is to send it an email and ask the user to click a link in that email to complete registration.
Short of that, there is a falible method of connecting to the mailserver. I'll see if I can find a good article(here you go) and edit this post with a link shortly.
This depends on the email provider. most of the providers block this option to prevent spammers from knowing which address is valid...

Categories

Resources